<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 27.04.12 22:00, Brett Cannon wrote:
    <blockquote
cite="mid:CAP1=2W7vVxgc1UQrKdc-5h9YxaKiPQobxhsg4opJbDxokA4z1g@mail.gmail.com"
      type="cite">
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Fri, Apr 27, 2012 at 10:39,
          Christian Tismer <span dir="ltr">&lt;<a
              moz-do-not-send="true" href="mailto:tismer@stackless.com"
              target="_blank">tismer@stackless.com</a>&gt;</span> wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div class="im">On 27.04.12 02:39, Nick Coghlan wrote:<br>
              <blockquote class="gmail_quote" style="margin:0 0 0
                .8ex;border-left:1px #ccc solid;padding-left:1ex">
                On Fri, Apr 27, 2012 at 7:30 AM, Christian Tismer&lt;<a
                  moz-do-not-send="true"
                  href="mailto:tismer@stackless.com" target="_blank">tismer@stackless.com</a>&gt;
                &nbsp;wrote:<br>
                <blockquote class="gmail_quote" style="margin:0 0 0
                  .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  No big deal and easy to work around, I just would like
                  to understand why.<br>
                </blockquote>
                I don't like it either and want to change it, but I'm
                also not going<br>
                to mess with it until the importlib bootstrapping is
                fully integrated<br>
                and stable.<br>
                <br>
                For the moment, there's a workaround in runpy to ensure
                at least<br>
                __main__.__file__ is always absolute (even when using
                the -m switch).<br>
                Longer term, I'd like to see __file__ and __path__
                entries to be<br>
                guaranteed to be *always* absolutely, even when they're
                imported<br>
                relative to the current working directory.<br>
                <br>
              </blockquote>
              <br>
            </div>
            Is there a recommendable way to fix this? I would like to
            tell people<br>
            what to do to make imports reliable. Either I put something
            into<br>
            the toplevel __init__ code, or I hack something into .pth or
            sitecustomize,<br>
            and then forget about this.<br>
            <br>
          </blockquote>
          <div><br>
          </div>
          <div>No, there isn't.</div>
          <div>&nbsp;</div>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            But I fear hacking __init__ is the only safe way that works
            without<br>
            a special python setup, which makes the whole reasoning
            rather<br>
            useless, because I can _not_ forget about this.... waah ;-)<br>
          </blockquote>
          <div><br>
          </div>
          <div>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.</div>
          <div><br>
          </div>
          <div>I'm personally in favour of changing the insertion of ''
            to sys.path to inserting the cwd when the interpreter is
            launched.</div>
        </div>
      </div>
    </blockquote>
    <br>
    Thanks Brett, that sounds pretty reasonable. '' always was too
    implicit for me.<br>
    <br>
    cheers - chris<br>
    <pre class="moz-signature" cols="72">-- 
Christian Tismer             :^)   <a class="moz-txt-link-rfc2396E" href="mailto:tismer@stackless.com">&lt;mailto:tismer@stackless.com&gt;</a>
tismerysoft GmbH             :     Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121     :    *Starship* <a class="moz-txt-link-freetext" href="http://starship.python.net/">http://starship.python.net/</a>
14482 Potsdam                :     PGP key -&gt; <a class="moz-txt-link-freetext" href="http://pgp.uni-mainz.de">http://pgp.uni-mainz.de</a>
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?   <a class="moz-txt-link-freetext" href="http://www.stackless.com/">http://www.stackless.com/</a></pre>
  </body>
</html>