My Python error...

Erik Max Francis max at
Sun Aug 3 22:39:19 CEST 2008

SaMTHG at wrote:

> Basically I have Mac OS X 10.4.11 and I've  got python 2.5.
> When I go to TextEdit and type in something like
> #!/usr/bin/env python
> print 2+2
> and save it as
> Then I go to terminal and cd my way to the dir that the script source
> is in and type:
> python
> And the output is:
> File "", line 1
> SyntaxError: Non-ASCII character '\xfe' in file on
> line 1, but no encoding declared; see
> for details
> What does this mean? And how do I make it work again?

It probably means that your text editor is saving as UTF-16 and it's 
seeing part of a byte order marker (0xFE 0xFF or 0xFF 0xFE depending on 
endianness) -- either that or you've accidentally injected some extra 
garbage into the file.  Save as ASCII instead.

Erik Max Francis && max at &&
  San Jose, CA, USA && 37 18 N 121 57 W && AIM, Y!M erikmaxfrancis
   Heaven ne'er helps the man who will not act.
    -- Sophocles

More information about the Python-list mailing list