py2exe windows apps path question
vincent at visualtrans.de
Tue Aug 2 22:07:19 CEST 2005
"Gregory Piñero" <gregpinero at gmail.com> schrieb im Newsbeitrag
news:mailman.2635.1123008925.10512.python-list at python.org...
> If you need something that works both on a frozen app as well as an
> (unfrozen) python
> script, you'd be better off using something like:
>> def getAppPrefix():
>> """Return the location the app is running from
>> isFrozen = False
>> isFrozen = sys.frozen
>> except AttributeError:
>> if isFrozen:
>> appPrefix = os.path.split(sys.executable)
>> appPrefix = os.path.split(os.path.abspath(sys.argv))
>> return appPrefix
>This sounds interesting. A few questions for you:
>Why don't I see sys.frozen in interpreter?
>Does it only appear when it is frozen?
Yes. The sys.frozen attribute is added by py2exe.
>What do you mean by frozen, how does python know?
Python doesn't know - it is just told so ;)
>What does sys.executable do?
sys.executable gives you the path of the executing binary. Normally, this
will be something like
"c:\\python24\\python.exe" - since the interpreter is the executing binary.
Once you have frozen your python application, it will return the path to
More information about the Python-list