Showing content from http://mail.python.org/pipermail/python-dev/attachments/20120428/303d513b/attachment.html below:
<div class="gmail_quote">On Sat, Apr 28, 2012 at 12:16 PM, R. David Murray <span dir="ltr"><<a href="mailto:rdmurray@bitdance.com">rdmurray@bitdance.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">That said, could this insertion of '' only happen when the interactive</div>
prompt is actually posted, and otherwise use cwd?<br></blockquote><div><br></div><div>That's already the case. Actually, sys.path[0] is *always* the absolute path of the script directory -- regardless of whether you invoked the script by a relative path or an absolute one, and regardless of whether you're importing 'site' -- at least on Linux and Cygwin and WIndows, for all Python versions I've used regularly, and 3.2 besides.</div>
<div><br></div><div>It isn't the value of cwd unless you happen to run a script from the same directory as the script itself. But even then, it's absolute, and not an empty string: the empty string is only present for interactive sessions.</div>
<div><br></div></div>
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4