Issue #115 new

.pyc 2.7 not compiling into app (Pygame)

Nick Panagakis
created an issue

When using a .py for the source file with pygame in compiling, it works, but with a .pyc, it does not. Any who, I exchanged email with the PSF and they redirected me here, for more information on the bug please read my forum post:

Comments (2)

  1. Ronald Oussoren repo owner

    py2app assumes that the main script is a python file, not a bytecode file. A future version will compile the main script for you, for now the easiest workaround is to split your script in two parts:

    • perform the actual work, preferably with a main() function. This module will be bytecompiled by py2app and included in in the app bundle.

    • does "import script; script.main()". This file is included as-is.

    The names of the two files aren't important, splitting the script in two parts is.

    That's assuming it it important for your that your script is byte compiled. Not byte compiling works just as well, but makes it slightly easier to read the code of your script ("slightly" because I've seen at least two projects that can convert byte-code back into a python script)

  2. Log in to comment