#30 Enalbe a way to know if running under py2exe

closed-works-for-me
nobody
None
5
2003-12-09
2003-12-09
Miki Tebeka
No

There are some differences when running from py2exe
(encodings, sys.path ...)

Enable a way for a script (sys.py2exe, PY2EXE in
globals, ...) to know if it is running from py2exe or not.

Miki

Discussion

  • Thomas Heller
    Thomas Heller
    2003-12-09

    • status: open --> closed
     
  • Thomas Heller
    Thomas Heller
    2003-12-09

    Logged In: YES
    user_id=11105

    I use this code snippet:

    import sys
    if not hasattr(sys, "frozen") and not hasattr(sys, "importers"):
    ....# we are running as frozen executable

    It has the advantage that it works with the 'old' and the
    'new' py2exe, and should also work with cx_freeze, McMillan,
    and the freeze tool.

    The newer py2exe versions set sys.frozen to something like
    'console_exe', 'windows_exe', and 'dll'.

     
  • Thomas Heller
    Thomas Heller
    2003-12-09

    • status: closed --> closed-works-for-me