Python 'except' clauses not working
<p>Hello Stack Overflow community.</p>

<p>I'm currently trying to learn how to program in Python (3.5) and I've had a problem with a conversion program. Summarised, it seems like Python is ignoring the except clauses in the source code.</p>

<pre><code>try:
    print("Welcome to CONVERSION. Choose an option.")
    print("1. Convert CELSIUS to FAHRENHEIT.")
    print("2. Convert FAHRENHEIT to CELSIUS.")
    Option = int(input("OPTION: "))
except NameError:
    print(Option, " is not a valid input.")
except ValueError:
    print(Option, " is not a valid input.")
except KeyboardInterrupt:
    print("Don't do that!")
else:
    if (Option != 1) or (Option != 2):
        print("Please input a valid option!")
    elif (Option == 1):
        try:
            Celsius = float(input("Enter value in Celsius: "))
        except ValueError:
            print(Celsius, " is not a valid input.")
        except KeyboardInterrupt:
            print("Don't do that!")
        else:
            Fahrenheit = Celsius * 1.8 + 32
        print(Celsius, "C = ", Fahrenheit, "F.")
    elif (Option == 2):
        try:
            Fahrenheit = float(input("Enter value in Fahrenheit: "))
        except ValueError:
            print(Celsius, " is not a valid input.")
        except KeyboardInterrupt:
            print("Don't do that!")
            Celsius = (Fahrenheit - 32) * ( 5 / 9 )
            print(Fahrenheit, "F = ", Celsius, "C.")
        else:
            print("That value is invalid. Try again.")
</code></pre>

<p>The full traceback, when inputting the value "wad" in the first screen:</p>

<pre><code>Traceback (most recent call last):
File "C:\Users\user\Documents\Visual Studio 2015\Projects\TempConversion\TempConversion\TempConversion.py", line 7, in &lt;module&gt;
Option = int(input("OPTION: "))
ValueError: invalid literal for int() with base 10: 'wad'

 During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\user\Documents\Visual Studio 2015\Projects\TempConversion\TempConversion\TempConversion.py", line 11, in &lt;module&gt;
print(Option, " is not a valid input.")
NameError: name 'Option' is not defined
</code></pre>

<p>You are trying to use variable <code>Option</code> in your string with error, but that variable doesn't exist, as it's the reason of the error. Try initiating <code>Option = input()</code> before the <code>try</code>  and convert it to int in <code>try</code></p>

python nameerror except