Re: [Python-Dev] sys.path in interactive session

2005-06-02 Thread Phillip J. Eby
At 05:08 PM 6/2/2005 -0700, Bob Ippolito wrote:
>On Jun 2, 2005, at 4:50 PM, Guido van Rossum wrote:
> >
> > I think that the "absolutizing" of sys.path entries is relatively new
> > (seems to have started in 2.3).
> >
> > Also note that it's not really the current directory but the directory
> > containing the script; that is definitely intentional.
>
>The absolutizing of sys.path in site.py is misbehavior anyway..

Your patch doesn't fix it doing this to __file__; probably this should not 
touch __file__ if a module has a __loader__ set, or if the path it's 
absolutizing doesn't exist.

Actually, your patch doesn't fix it doing this to all the sys.path entries, 
either.  It appears that site.py may be quite broken with respect to PEP 
302.  Fixing it is going to be interesting, since it's quite possible that 
you can have stuff on PYTHONPATH for which the sys.path_hooks entries don't 
exist yet.  Thus, you can't guarantee when you absolutize a path entry that 
it is in fact a filename, unless you check for its existence - which in 
principle could be a coincidence.

It may be that we need to define more clearly what is allowed on sys.path, 
such that site.py can tell the difference between filesystem paths, and 
non-filesystem PEP 302 specifiers.  Right now, the only major PEP 302 
implementation that I know of is zipimport, but zipimport uses strings that 
are effectively filesystem paths, so site.py doesn't break them.


___
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


Re: [Python-Dev] sys.path in interactive session

2005-06-02 Thread Bob Ippolito
On Jun 2, 2005, at 4:50 PM, Guido van Rossum wrote:

> On 6/2/05, Reinhold Birkenfeld  [EMAIL PROTECTED]> wrote:
>
>> While looking at bug #779191, I saw that sys.path's first element
>> is '' in interactive sessions, but the current dir otherwise. Is this
>> intentional?
>>
>
> I've always liked it this way; using "" instead of "." means that if
> you os.path.join() it with a script name you don't get a spurious "./"
> prepended.
>
> I think that the "absolutizing" of sys.path entries is relatively new
> (seems to have started in 2.3).
>
> Also note that it's not really the current directory but the directory
> containing the script; that is definitely intentional.

The absolutizing of sys.path in site.py is misbehavior anyway.. it  
spits in the face of path hooks, for example .

I still haven't committed that patch, I haven't had a whole lot of  
Python-time lately with co-founding a new company, preparing to move,  
WWDC, etc... but nobody bothered to complain, so if someone wants to  
commit  before I get a chance, feel free!

-bob

___
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


Re: [Python-Dev] sys.path in interactive session

2005-06-02 Thread Guido van Rossum
I've always liked it this way; using "" instead of "." means that if
you os.path.join() it with a script name you don't get a spurious "./"
prepended.

I think that the "absolutizing" of sys.path entries is relatively new
(seems to have started in 2.3).

Also note that it's not really the current directory but the directory
containing the script; that is definitely intentional.

On 6/2/05, Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote:
> While looking at bug #779191, I saw that sys.path's first element
> is '' in interactive sessions, but the current dir otherwise. Is this
> intentional?
> 
> Reinhold
> 
> --
> Mail address is perfectly valid!
> 
> ___
> 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/guido%40python.org
> 


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
___
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


[Python-Dev] sys.path in interactive session

2005-06-02 Thread Reinhold Birkenfeld
While looking at bug #779191, I saw that sys.path's first element
is '' in interactive sessions, but the current dir otherwise. Is this
intentional?

Reinhold

-- 
Mail address is perfectly valid!

___
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