views:

69

answers:

1

I'm trying out a hello world python script on WinXP. When I execute:

python test.py arg1.log

I get an error for the first line of the script, which is 'import sys':

File "test.py", line 1, in <module>
i
NameError: name 'i' is not defined

Any suggestions?

+10  A: 

You've saved the file as Windows Unicode (aka UTF-16, aka UCS-2) rather than ASCII or UTF-8.

If your editor has an Encoding option (or something under "Save As" for the encoding) change it to UTF-8.

If your editor has no such option, you can load it into Notepad and save it as UTF-8.

RichieHindle
+1 for psychic debugging
Greg Hewgill