admin管理员组文章数量:1396114
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
本文标签: pythonSyntaxError NonUTF8 code starting with 39xb939 in pyzStack Overflow
版权声明:本文标题:python - SyntaxError: Non-UTF-8 code starting with 'xb9' in pyz - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744127158a2592007.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论