Correct idiom for determining path when frozen in 3.4

Mark Summerfield list at qtrac.plus.com
Mon Mar 17 04:44:23 EDT 2014


Hi,

What is the correct idiom for getting the path to a top-level module in 3.3 and 3.4 when the module might be frozen?

At the moment I'm using this:

    if getattr(sys, "frozen", False):
        path = os.path.dirname(sys.executable)
    else:
        path = os.path.dirname(__file__)

Thanks!



More information about the Python-list mailing list