I'm completely new to Python, just started going through the tutorial at python.org but am getting compile errors in places that should not be errors. I've installed Python version 3.1 on a Windows 7 machine, but I don't see any documented compatability issues.

For an example, here's some simple sample code I got online which I've copied into a .py file and use IDLE to edit:

import string, sys

# If no arguments were given, print a helpful message
if len(sys.argv)==1:
    print 'Usage: celsius temp1 temp2 ...'   [B]#error 1[/B]

# Loop over the arguments
for i in sys.argv[1:]:
    except string.atoi_error:
	print repr(i), "not a numeric value"[B] #error 2[/B]
	print '%i\260F = %i\260C' % (int(fahrenheit), int(celsius+.5))

Using ctrl+x to check the module, the closing quote in error 1 is highlighted and I'm given an "Invalid Syntax" error. I got the same thing when typing the first tutorial example into the command prompt, the closing quote with either " or ' would generate a syntax error.

I don't know if it's related, but for error #2, if I comment out or delete the first print line and press alt+x, the entire empty line behind the closing quote is highlighted and the error given is "inconsistent use of tabs and spaces in indentation."

So anyone know what could possibly be wrong here?

Edit: problem solved. Thanks Shady.

Edited 7 Years Ago by RandV80: n/a

This question has already been answered. Start a new discussion instead.