Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #68418

Re: Correct idiom for determining path when frozen in 3.4

References <8a0ca549-7bce-4210-8f9e-3465a769fc3c@googlegroups.com>
From Oscar Benjamin <oscar.j.benjamin@gmail.com>
Date 2014-03-17 09:52 +0000
Subject Re: Correct idiom for determining path when frozen in 3.4
Newsgroups comp.lang.python
Message-ID <mailman.8183.1395050301.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 17 March 2014 08:44, Mark Summerfield <list@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Correct idiom for determining path when frozen in 3.4 Mark Summerfield <list@qtrac.plus.com> - 2014-03-17 01:44 -0700
  Re: Correct idiom for determining path when frozen in 3.4 Ben Finney <ben+python@benfinney.id.au> - 2014-03-17 20:02 +1100
  Re: Correct idiom for determining path when frozen in 3.4 Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-03-17 02:16 -0700
  Re: Correct idiom for determining path when frozen in 3.4 Ben Finney <ben+python@benfinney.id.au> - 2014-03-17 20:23 +1100
  Re: Correct idiom for determining path when frozen in 3.4 Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-03-17 09:52 +0000
  Re: Correct idiom for determining path when frozen in 3.4 Mark Summerfield <list@qtrac.plus.com> - 2014-03-17 08:31 -0700
    Re: Correct idiom for determining path when frozen in 3.4 Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-03-17 11:03 -0500

csiph-web