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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <oscar.j.benjamin@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.039
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'else:': 0.03; 'cc:addr :python-list': 0.11; 'cc:name:python list': 0.16; 'false):': 0.16; 'getattr(sys,': 0.16; 'subject:when': 0.16; 'top-level': 0.16; 'wrote:': 0.18; 'module': 0.19; 'cc:addr:python.org': 0.22; 'this?': 0.23; 'cc:2**0': 0.24; 'this:': 0.26; 'header:In-Reply- To:1': 0.27; 'correct': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'getting': 0.31; 'url:python': 0.33; 'moment': 0.34; 'received:google.com': 0.35; 'hi,': 0.36; 'url:org': 0.36; 'skip:o 20': 0.38; 'url:library': 0.38; 'does': 0.39; 'skip:o 30': 0.61; 'march': 0.61; 'url:3': 0.61; '3.4': 0.84; 'idiom': 0.84; 'oscar': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=faQUzf74MSWM6YnoVDEwIlFZ8XqSN3eU0/D7qwgqGSg=; b=QQEorLPanv62+ufyRaIfaHNydDVsn/FxgImN5Q8X5XQAU8eIeTNwFt5uiurh5W3eiN j+jKV1lo0E1NBHURl4X0PGcIAh+eogJpmdgXKjUvGdLItPgxPZh+VBmroLQadLfzopMs G5jZnRm7mrT1pOjbNxsugGnjsevL8/+EntpGp/NdYiBdVEbqT6Azd3/eICChENeyIlBx Vqoabx443UE14pdlMy9usLY1uLO0JEN5Vy+NMbnzOPNdgFHshG8A9NyH54NkmD457DcG DRJZf1kdjRvNJEFc3DmyfVIB1e2D3fhdfVEdYG5nx145gkyafmjDc6J4BVN/HwtNXpn0 tIvg==
X-Received by 10.58.178.238 with SMTP id db14mr386538vec.25.1395049995649; Mon, 17 Mar 2014 02:53:15 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <8a0ca549-7bce-4210-8f9e-3465a769fc3c@googlegroups.com>
References <8a0ca549-7bce-4210-8f9e-3465a769fc3c@googlegroups.com>
From Oscar Benjamin <oscar.j.benjamin@gmail.com>
Date Mon, 17 Mar 2014 09:52:55 +0000
Subject Re: Correct idiom for determining path when frozen in 3.4
To Mark Summerfield <list@qtrac.plus.com>
Content-Type text/plain; charset=ISO-8859-1
Cc Python List <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.8183.1395050301.18130.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1395050301 news.xs4all.nl 2889 [2001:888:2000:d::a6]:35591
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:68418

Show key headers only | 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