[Distutils] How to handle launcher script importability?

PJ Eby pje at telecommunity.com
Sun Aug 11 18:23:48 CEST 2013


On Sun, Aug 11, 2013 at 12:17 PM, PJ Eby <pje at telecommunity.com> wrote:
> May I suggest an option 5 instead?  Use the new .pyz (or .pyzw for
> non-console apps) as a zipped Python application.  .pyz files aren't
> importable, but *are* executable.  That's basically all that's needed
> to prevent importing -- a file extension that's launchable but not
> importable.

(Details I forgot to mention: the script would be in __main__.py
inside the zipped application file, and it would need to change
sys.path[0], because sys.path[0] will be the .pyz file itself; it
should replace it with the directory containing the .pyz file before
doing anything else.  That would be the correct way to simulate the
existing .exe approach.)


More information about the Distutils-SIG mailing list