Pyinstaller: SyntaxError: Non-UTF-8 code ... but no encoding declared

Created on 26 Jan 2016  路  3Comments  路  Source: pyinstaller/pyinstaller

After packaging the example from https://github.com/pyinstaller/pyinstaller/issues/1780#issue-127366372 with the develop branch, i get this error while running the executable:

$ python ./dist/a/a.exe
  File "./dist/a/a.exe", line 1
SyntaxError: Non-UTF-8 code starting with '\x90' in file ./dist/a/a.exe on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

The error is not present with 3.0 or 3.1, and encoding headers should not be needed for python 3 anyway, because utf-8 is the default.

support invalid

Most helpful comment

@codewarrior0, oh that was a silly mistake, thanks! :stuck_out_tongue_winking_eye:

All 3 comments

a.exe is a Windows executable, not a Python script. Instead of passing it to Python, just run it as is:

./dist/a/a.exe

@codewarrior0, oh that was a silly mistake, thanks! :stuck_out_tongue_winking_eye:

@dessant I also made the same mistake and landed here.
@codewarrior0 Thanks for helping me. I feel silly

Was this page helpful?
0 / 5 - 0 ratings