On 27.04.12 22:00, Brett Cannon wrote:
On Fri, Apr 27, 2012 at 10:39, Christian Tismer <tis...@stackless.com
<mailto:tis...@stackless.com>> wrote:
On 27.04.12 02:39, Nick Coghlan wrote:
On Fri, Apr 27, 2012 at 7:30 AM, Christian
Tismer<tis...@stackless.com <mailto:tis...@stackless.com>> wrote:
No big deal and easy to work around, I just would like to
understand why.
I don't like it either and want to change it, but I'm also not
going
to mess with it until the importlib bootstrapping is fully
integrated
and stable.
For the moment, there's a workaround in runpy to ensure at least
__main__.__file__ is always absolute (even when using the -m
switch).
Longer term, I'd like to see __file__ and __path__ entries to be
guaranteed to be *always* absolutely, even when they're imported
relative to the current working directory.
Is there a recommendable way to fix this? I would like to tell people
what to do to make imports reliable. Either I put something into
the toplevel __init__ code, or I hack something into .pth or
sitecustomize,
and then forget about this.
No, there isn't.
But I fear hacking __init__ is the only safe way that works without
a special python setup, which makes the whole reasoning rather
useless, because I can _not_ forget about this.... waah ;-)
Yeah, to guarantee the semantics you are after you have to grab that
'' entry in sys.path as early as possible and substitute it with the
cwd so that its initial value propagates through the interpreter.
Importlib is already having to jump through some hoops to treat it as
'.' and even that doesn't get you what you want since that will change
when the cwd is moved.
I'm personally in favour of changing the insertion of '' to sys.path
to inserting the cwd when the interpreter is launched.
Thanks Brett, that sounds pretty reasonable. '' always was too implicit
for me.
cheers - chris
--
Christian Tismer :^)<mailto:tis...@stackless.com>
tismerysoft GmbH : Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121 : *Starship* http://starship.python.net/
14482 Potsdam : PGP key -> http://pgp.uni-mainz.de
work +49 173 24 18 776 mobile +49 173 24 18 776 fax n.a.
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com