[pypy-dev] PYTHONPATH handling doesn't seem to match Python

Skip Montanaro skip.montanaro at gmail.com
Fri Jun 28 22:41:49 CEST 2013


PyPy doesn't seem to handle PYTHONPATH the same way Python does.
Consider this:

% echo $PWD:$PYTHONPATH
/home/skipm/src/git/models/lenin:/home/skipm/src/tl_v11/prefix/lib/python2.7/site-packages:/opt/TWWfsw/libgtk+222/lib/python27/gtk-2.0

Now, run Python with that set as PYTHONPATH and see where directories
land.  I've trimmed out all the other elements which don't
matter. Note that

/home/skipm/src/tl_v11/prefix/lib/python2.7/site-packages

appears in sys.path ahead of

/opt/local/lib/python2.7/site-packages

hornet% PYTHONPATH=$PWD:$PYTHONPATH python
Python 2.7.2 (default, Nov 14 2012, 05:07:35)
[GCC 4.4.6 [TWW]] on linux3
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
[..., '/home/skipm/src/tl_v11/prefix/lib/python2.7/site-packages',
..., '/opt/local/lib/python2.7/site-packages', ...]

Now, try the same experiment with PyPy.  The relative order of those
two directories is reversed:

hornet% PYTHONPATH=$PWD:$PYTHONPATH pypy
Python 2.7.3 (5acfe049a5b0cd0de158f62553a98f5ef364fd29, Jun 28 2013, 15:39:43)
[PyPy 2.0.2] on linux3
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``"there should be one and only one
obvious way to do it". PyPy variant: "there can be N half-buggy ways to do
it"''
>>>> import sys
>>>> sys.path
[..., '/opt/local/lib/python2.7/site-packages', ...,
'/home/skipm/src/tl_v11/prefix/lib/python2.7/site-packages', ...]

They each hold the copies of the internal development platform I work
on.  Since I am actively developing software using that platform, I
prefer to have my development version ahead of our production install.
 Is there a way to make that work?

Thx,

Skip


More information about the pypy-dev mailing list