New submission from Armin Rigo:

On Posix, it is documented that setting PATH to the empty string is equivalent 
to not setting PATH at all, which is an exception to the rule that in a string 
like "/bin::/usr/bin" the empty string in the middle gets interpreted as ".".

PYTHONPATH does not have this exception: an empty PYTHONPATH is interpreted as 
equivalent to ".".

This difference is not documented.  This is a detail, but a possible source of 
confusion, so I'm reporting it here.

How to reproduce:

file x/x.py: "import z"
file z.py: "print(42)"

The following two lines behave differently (Bash syntax):

PYTHONPATH= python x/x.py
unset PYTHONPATH && python x/x.py

For comparison, if "./foo" is an executable, the following two lines behave 
identically (neither finds "./foo"):

PATH= foo
unset PATH && foo

----------
components: Interpreter Core
keywords: easy
messages: 173665
nosy: arigo
priority: normal
severity: normal
status: open
title: "PYTHONPATH=" different from no PYTHONPATH at all
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16309>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to