Packaged EXE file running error

Use code in zipapp — Manage executable Python zip archives — Python 3.11.0b3 documentation
SyntaxError: Non-UTF-8 code starting with '\x90' in file "", but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
I read pep263 but didn’t solve the problem.

There are too many unknowns here to make sense of what is happening!

  1. What is in the zip file?

  2. How did you create the zip file?

  3. What code are you running that gives that error?

  4. What OS are you using? Windows, Linux, OS X, something else?

  5. Does your code work in Python 3.10?

But if I were to take a wild guess, I will suggest this…

For each .py file inside the zip file, open the file in your text editor and make sure they are saved using UTF-8 with no “BOM” (byte order mark) or signature. Then recompress into a zip file and try again.

And make sure that the zip file is not encrypted or password protected.

This is a wild guess of the problem, it could be completely wrong. If it doesn’t help, we need more information to solve the problem.

It would be really good if you could reproduce the same error in a zipapp containing just a single .py file.