On Sat, Apr 28, 2012 at 12:16 PM, R. David Murray <rdmur...@bitdance.com>wrote:

> That said, could this insertion of '' only happen when the interactive
> prompt is actually posted, and otherwise use cwd?
>

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.

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.
_______________________________________________
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

Reply via email to