"Gregory PiƱero" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > 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 >> try: >> isFrozen = sys.frozen >> except AttributeError: >> pass >> if isFrozen: >> appPrefix = os.path.split(sys.executable)[0] >> else: >> appPrefix = os.path.split(os.path.abspath(sys.argv[0]))[0] >> return appPrefix >> > >Vincent, > >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 your app. -- Vincent > >Thanks, > >Greg
-- http://mail.python.org/mailman/listinfo/python-list