I believe you want something like this:
# Loop until a break statement is encountered
while True:
# Start an error-handling block
try:
# Get the user input and make it an integer
inp = int(raw_input("Enter 1 or 2: "))
# If a ValueError is raised, it means that the input was not a number
except ValueError:
# So, jump to the top of the loop and start-over
continue
# If we get here, then the input was a number. So, see if it equals 1 or 2
if inp in (1, 2):
# If so, break the loop because we got valid input
break
See a demonstration below:
>>> while True:
... try:
... inp = int(raw_input("Enter 1 or 2: "))
... except ValueError:
... continue
... if inp in (1, 2):
... break
...
Enter 1 or 2: 3
Enter 1 or 2: a
Enter 1 or 2: 1
>>>