Correct idiom for determining path when frozen in 3.4
Oscar Benjamin
oscar.j.benjamin at gmail.com
Mon Mar 17 05:52:55 EDT 2014
On 17 March 2014 08:44, Mark Summerfield <list at qtrac.plus.com> wrote:
> 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__)
Why do you want to know this? Does pkgutil.get_data do what you want?
http://docs.python.org/3.3/library/pkgutil.html#pkgutil.get_data
Oscar
More information about the Python-list
mailing list