About some problem

Rustom Mody rustompmody at gmail.com
Thu Jan 2 12:46:26 EST 2014


On Thu, Jan 2, 2014 at 11:06 PM, Ned Batchelder <ned at nedbatchelder.com> wrote:
> On 1/2/14 12:05 PM, Rustom Mody wrote:
>
>>
>> i'm not sure about this but isnt it normally the case that different
>> version modules dont get mixed up like that?
>> IOW if pytesser was a properly packaged 2.7 module would python 3 be
>> able to get at it ??
>>
>
> If you use a Python 3 installer it can succeed at installing a Python 2
> package. Then you won't find out until you try to run the package that it is
> incompatible.  A mechanism to prevent this seems like a good idea, but since
> it wasn't in place at the dawn of Python 3, it would be difficult to put in
> place now.

$ python3
Python 3.3.3 (default, Dec  8 2013, 16:34:29)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from sys import path
>>> path
['', '/usr/lib/python3.3', '/usr/lib/python3.3/plat-i386-linux-gnu',
'/usr/lib/python3.3/lib-dynload',
'/usr/local/lib/python3.3/dist-packages',
'/usr/lib/python3/dist-packages']


$ python
Python 2.7.6 (default, Dec  6 2013, 21:56:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from sys import path
>>> path
['', '/usr/local/lib/python2.7/dist-packages/pip-1.0-py2.7.egg',
'/usr/lib/python2.7', '/usr/lib/python2.7/plat-i386-linux-gnu',
'/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PILcompat',
'/usr/lib/python2.7/dist-packages/gst-0.10',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.7',
'/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']


So as far as I can see (on a debian linux system) the paths are
clearly 2.7-prefixed or 3.3-prefixed.

So apart from being stupid and/or malicious to munge sys.path to tread
on the other python's toes...???

Oh ok I get what you are saying: python3 will not recognize a python2
package and install it seemingly correctly but actually wrongly



More information about the Python-list mailing list