I have a pyz that I'm building on GitHub using an Ubuntu docker container.
We're using poetry's pyinstaller command. something like:
poetry run pyinstaller test_pyz.spec --noconfirm --distpath build/pyz
The test_pyz.spec
file has # -*- mode: python ; coding: utf-8 -*-
at the top.
When I take the file and copy it to a Mac and run python3 test.pyz
I am getting the following error:
SyntaxError: Non-UTF-8 code starting with '\xb9' in file
/tmp/test.pyz on line 2, but no encoding declared; see
/ for details
I have tried also setting an environment variable before the poetry command but have the same problem:
PYTHONIOENCODING=utf-8 poetry run pyinstaller test_pyz.spec --noconfirm --distpath build/pyz
Any suggestions on what else to check for? It seems like all of the encoding is correct so I'm not sure what's going on here.
After some more thought, I don't think we're creating a true pyz but a python executable via pyinstaller. Are we using this wrong?
I have a pyz that I'm building on GitHub using an Ubuntu docker container.
We're using poetry's pyinstaller command. something like:
poetry run pyinstaller test_pyz.spec --noconfirm --distpath build/pyz
The test_pyz.spec
file has # -*- mode: python ; coding: utf-8 -*-
at the top.
When I take the file and copy it to a Mac and run python3 test.pyz
I am getting the following error:
SyntaxError: Non-UTF-8 code starting with '\xb9' in file
/tmp/test.pyz on line 2, but no encoding declared; see
http://python./dev/peps/pep-0263/ for details
I have tried also setting an environment variable before the poetry command but have the same problem:
PYTHONIOENCODING=utf-8 poetry run pyinstaller test_pyz.spec --noconfirm --distpath build/pyz
Any suggestions on what else to check for? It seems like all of the encoding is correct so I'm not sure what's going on here.
After some more thought, I don't think we're creating a true pyz but a python executable via pyinstaller. Are we using this wrong?
Share Improve this question edited Mar 26 at 20:42 Andre Gagne asked Mar 26 at 20:23 Andre GagneAndre Gagne 316 bronze badges 1- Edit the question and try to make a minimal reproducible example. – Mark Tolonen Commented Mar 26 at 20:44
1 Answer
Reset to default 0After looking more into https://pyinstaller./en/stable/operating-mode.html
I am realizing that although we name the file .pyz
it is, in fact, not a .pyz
but an executable for Ubuntu