[PyPy-issue] [issue505] site.py in local directory imported on startup.

Antonio Cuni pypy-dev-issue at codespeak.net
Thu Jul 15 15:08:10 CEST 2010


Antonio Cuni <anto.cuni at gmail.com> added the comment:

It seems that cpython behaves differently in the cases in which PYTHONPATH is
empty or unset:

anaconda foo $ echo $PYTHONPATH
:/home/antocuni/WebFormKit:/home/antocuni/pypy/trunk/:/home/antocuni/pypy/user/antocuni/:/home/antocuni/pypy/user/antocuni/hack/:/home/antocuni/pypy/misc/pg8000/:/home/antocuni/pypy/misc/casalino-carta/:/home/antocuni/pypy/misc/execnet/
anaconda foo $ python -c 'import site; print site'
<module 'site' from 'site.pyc'>
anaconda foo $ PYTHONPATH= python -c 'import site; print site'
<module 'site' from 'site.pyc'>
anaconda foo $ unset PYTHONPATH
anaconda foo $ python -c 'import site; print site'
<module 'site' from '/usr/lib/python2.6/site.pyc'>

I think the cause is that an empty PYTHONPATH triggers the insertion of two ''
in sys.path:
anaconda foo $ export PYTHONPATH=
anaconda foo $ python -S -c 'import sys; print sys.path'
['', '', '/usr/lib/python2.6/', '/usr/lib/python2.6/plat-linux2',
'/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old',
'/usr/lib/python2.6/lib-dynload']
anaconda foo $ unset PYTHONPATH
anaconda foo $ python -S -c 'import sys; print sys.path'
['', '/usr/lib/python2.6/', '/usr/lib/python2.6/plat-linux2',
'/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old',
'/usr/lib/python2.6/lib-dynload']


I think that this explains why regebro and armin see different results on
cpython. The problem in pypy still exists

_______________________________________________________
PyPy development tracker <pypy-dev-issue at codespeak.net>
<https://codespeak.net/issue/pypy-dev/issue505>
_______________________________________________________



More information about the Pypy-issue mailing list