Python BOM error in Ascii file

后端 未结 1 640
无人及你
无人及你 2021-01-05 22:20

I have a weird, annoying problem with Python 2.6. I\'m trying to run this file (and the other), on my Embedded Linux ARM board. http://svn.tuxisalive.com/software_suite_v3/

相关标签:
1条回答
  • 2021-01-05 22:59

    Don't get too hung up on the "with BOM" remark. It's probably not relevant. What this error usually means is that the Python you are trying to run in does not support the encoding you declare. Observe:

    % head -1 tmp.py
    # -*- coding: asdfasdfasdf -*-
    % python tmp.py
      File "tmp.py", line 1
    SyntaxError: encoding problem: with BOM
    

    The Python installation you are running on this Embedded Linux ARM board probably lacks the 'latin-1' encoding. Since you don't have any non-ASCII characters in your source file, just declare the encoding as 'ascii', or leave out the encoding altogether.

    0 讨论(0)
提交回复
热议问题