'Pyinstaller throwing out AssertionError

So, I had been working on this game i created using sockets and pygame, and now I wish to send it to another computer. I do not want to send the files as is, but instead an executable that I can run without downloading and installing anything new.

I tried using pyinstaller, but it threw an AssertionError

File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/utils/osx.py", line 195, in fix_exe_for_code_signing
    assert len(sign_sec) == 0, "Executable contains code signature!"
AssertionError: Executable contains code signature!

I am on MacOS Sierra, version 10.12.6

Any help would be highly appreciated.



Solution 1:[1]

It seems this was a problem with python3.8, the pyinstaller commands work just fine for python3.7 and python3.9

Solution 2:[2]

I went through the same problem. I am on macOS High Sierra v10.13.6, and I was generating my executable with a custom code-sign certificate that I saw how to generate here.

Then I used something like the following to generate the executable:

pyinstaller --name GraphFilter --noconsole --codesign-identity GraphFilter app.py

And it worked fine.

However, I needed to generate another executable. Using the same command, I got the same error as you.

What I did was to restart the system (Windows trauma) and then generate another code-sign certificate. Then I ran the the command again and it worked like a charm.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 xxSirFartAlotxx
Solution 2 Lavínia Beghini