On Mon, Mar 17, 2014 at 10:31 AM, Mark Summerfield wrote:
> My code was adapted from this:
> http://cx-freeze.readthedocs.org/en/latest/faq.html#using-data-files
>
> When you freeze a Python program with cx_Freeze, sys.freeze exists; but
> otherwise it doesn't.
>
> I develop some programs which I
On Monday, 17 March 2014 08:44:23 UTC, Mark Summerfield 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):
>
>
On 17 March 2014 08:44, Mark Summerfield 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.executa
Devin Jeanpierre writes:
> On Mon, Mar 17, 2014 at 2:02 AM, Ben Finney
> wrote:
> > Mark Summerfield writes:
> > if getattr(sys, "frozen"):# ‘getattr’ will return None by default
>
> No it won't.
> […]
> Sure, but sys.executable always exists.
My apologies for posting untested code wi
On Mon, Mar 17, 2014 at 2:02 AM, Ben Finney wrote:
> Mark Summerfield writes:
> if getattr(sys, "frozen"):# ‘getattr’ will return None by default
No it won't.
> Lastly, it's slightly more Pythonic to execute the normal path
> unconditionally, and let it raise an exception if there's a p
Mark Summerfield writes:
> What is the correct idiom for getting the path to a top-level module
I'm not sure I understand what this concept is. What do you mean by
“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, "fr
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!