Differences between revisions 2 and 4 (spanning 2 versions)
Revision 2 as of 2008-07-08 11:27:43
Size: 643
Editor: localhost
Comment: converted to 1.6 markup
Revision 4 as of 2024-06-30 16:42:07
Size: 291
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
ThomasHeller posted this tip to the mailing list:

`main_is_frozen()` returns `True` when running the exe, and `False` when
running from a script.

`get_main_dir()` returns the directory name of the script or the directory
name of the exe - this is also sometimes useful.

{{{
#!python

import imp, os, sys

def main_is_frozen():
   return (hasattr(sys, "frozen") or # new py2exe
           hasattr(sys, "importers") # old py2exe
           or imp.is_frozen("__main__")) # tools/freeze

def get_main_dir():
   if main_is_frozen():
       return os.path.dirname(sys.executable)
   return os.path.dirname(sys.argv[0])
}}}
I'm Sonya, and I live in Bogong. <<<BR>>
><<<BR>>
>
I'm interested in Educational Studies, Scrapbooking, and Spanish art. I like exploring and reading fantasy.<<<BR>>
><<<BR>>
>
<<<BR>>
><<<BR>>
>
Here is my homepage:: [[https://glycooptimizer.com|Glyco Optimizer Blood Support]]

I'm Sonya, and I live in Bogong. <
><
> I'm interested in Educational Studies, Scrapbooking, and Spanish art. I like exploring and reading fantasy.<
><
> <
><
> Here is my homepage:: Glyco Optimizer Blood Support

HowToDetermineIfRunningFromExe (last edited 2024-06-30 17:21:02 by JimmyRetzlaff)