[Pythonmac-SIG] how do you determine if you're running a bundlebuilder standalone?

Bob Ippolito bob at redivi.com
Sat Aug 21 00:06:19 CEST 2004


On Aug 20, 2004, at 2:09 PM, Kevin Altis wrote:

> I have the following function for determining at runtime whether a 
> program is running standalone, but it needs to be updated for Mac OS X 
> and bundlebuilder.
>
> # Thomas Heller's function for determining
> # if a module is running standalone
> def main_is_frozen():
>     return (hasattr(sys, "importers") # py2exe
>             or imp.is_frozen("__main__") # cx_freeze or tools/freeze
>             or hasattr(sys, "frozen") # McMillan installer
>             )
>
> What's the magic attribute for bundlebuilder standalones?

FWIW, I don't think hasattr(sys, "importers") is ever true on py2exe, 
at least not 0.5.3.. that word isn't in the source at all.  It uses 
sys.frozen as well, which is what I plan on using for py2app (likely 
sys.frozen == 'macosx_app').

-bob


More information about the Pythonmac-SIG mailing list