From: Patrick B. <pbi...@us...> - 2010-01-31 21:27:30
Attachments:
signature.asc
|
Hi! I have a problem with PyUSB and Python 3: Everything seems to run fine with Python 2.6, but when I'm using Python 3.1, an ImportError is raised when I try to import any part of PyUSB: >>> import usb.core Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.1/dist-packages/usb/__init__.py", line 24, in <module> from legacy import * ImportError: No module named legacy By running "python -v -v" and "python3 -v -v", I found that Python 3 is not recursing into dist-packages/usb when it's looking for legacy.py, while 2.6 does. Is this a bug in the v3 __init__.py or is something wrong with my Python 3 setup? -- Patrick |
From: Wander L. <wan...@gm...> - 2010-01-31 23:07:38
|
I haven't tested PyUSB with Python 3 yet. Therefore the most probable is that this is an issue with PyUSB. Could you please open a bug in the sf tracker? Wander 2010/2/1 Patrick Birnzain <pbi...@us...>: > Hi! > > I have a problem with PyUSB and Python 3: > Everything seems to run fine with Python 2.6, but when I'm using Python > 3.1, an ImportError is raised when I try to import any part of PyUSB: > >>>> import usb.core > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/usr/local/lib/python3.1/dist-packages/usb/__init__.py", line > 24, in <module> > from legacy import * > ImportError: No module named legacy > > By running "python -v -v" and "python3 -v -v", I found that Python 3 is > not recursing into dist-packages/usb when it's looking for legacy.py, > while 2.6 does. > Is this a bug in the v3 __init__.py or is something wrong with my Python > 3 setup? > > -- Patrick > > > ------------------------------------------------------------------------------ > The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the business > Choose flexible plans and management services without long-term contracts > Personal 24x7 support from experience hosting pros just a phone call away. > http://p.sf.net/sfu/theplanet-com > _______________________________________________ > Pyusb-users mailing list > Pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users > > |
From: Wander L. <wan...@gm...> - 2010-02-04 08:14:44
|
I have been investigating the problem and found the answer. Python 3 changed the rules to find intra-package modules. You do it through relative imports. Details can be found here: http://diveintopython3.org/porting-code-to-python-3-with-2to3.html#import But now I am stuck. I would like to make PyUSB running on any Python version >= 2.3, this including Python 3 series. But relative imports was added only in Python 2.5. So, to make Python interoperable between series 2 and 3, I would have to change version requirement to >= 2.5... I know that some people still use PyUSB with 2.3 version, but I am afraid I will have to break compatibility with versions 2.3 and 2.4... :( Any suggestion? Wander 2010/2/1 Patrick Birnzain <pbi...@us...>: > Alright, will do. > I'll further investigate that and let you know if I find the problem. > > -- Patrick > > > Wander Lairson wrote: >> I haven't tested PyUSB with Python 3 yet. Therefore the most probable >> is that this is an issue with PyUSB. Could you please open a bug in >> the sf tracker? >> >> Wander >> >> 2010/2/1 Patrick Birnzain <pbi...@us...>: >> >>> Hi! >>> >>> I have a problem with PyUSB and Python 3: >>> Everything seems to run fine with Python 2.6, but when I'm using Python >>> 3.1, an ImportError is raised when I try to import any part of PyUSB: >>> >>> >>>>>> import usb.core >>>>>> >>> Traceback (most recent call last): >>> File "<stdin>", line 1, in <module> >>> File "/usr/local/lib/python3.1/dist-packages/usb/__init__.py", line >>> 24, in <module> >>> from legacy import * >>> ImportError: No module named legacy >>> >>> By running "python -v -v" and "python3 -v -v", I found that Python 3 is >>> not recursing into dist-packages/usb when it's looking for legacy.py, >>> while 2.6 does. >>> Is this a bug in the v3 __init__.py or is something wrong with my Python >>> 3 setup? >>> >>> -- Patrick >>> >>> >>> ------------------------------------------------------------------------------ >>> The Planet: dedicated and managed hosting, cloud storage, colocation >>> Stay online with enterprise data centers and the best network in the business >>> Choose flexible plans and management services without long-term contracts >>> Personal 24x7 support from experience hosting pros just a phone call away. >>> http://p.sf.net/sfu/theplanet-com >>> _______________________________________________ >>> Pyusb-users mailing list >>> Pyu...@li... >>> https://lists.sourceforge.net/lists/listinfo/pyusb-users >>> >>> >>> >> >> ------------------------------------------------------------------------------ >> The Planet: dedicated and managed hosting, cloud storage, colocation >> Stay online with enterprise data centers and the best network in the business >> Choose flexible plans and management services without long-term contracts >> Personal 24x7 support from experience hosting pros just a phone call away. >> http://p.sf.net/sfu/theplanet-com >> _______________________________________________ >> Pyusb-users mailing list >> Pyu...@li... >> https://lists.sourceforge.net/lists/listinfo/pyusb-users >> >> > > |
From: Wander L. <wan...@gm...> - 2010-02-06 05:17:33
|
I fixed this issue at rev 44, but broken compatibility with Python 2.4 and 2.5. At rev 45 I fixed the compatibility issues. Wander 2010/2/4 Wander Lairson <wan...@gm...>: > I have been investigating the problem and found the answer. Python 3 > changed the rules to find intra-package modules. You do it through > relative imports. > > Details can be found here: > http://diveintopython3.org/porting-code-to-python-3-with-2to3.html#import > > But now I am stuck. I would like to make PyUSB running on any Python > version >= 2.3, this including Python 3 series. But relative imports > was added only in Python 2.5. So, to make Python interoperable between > series 2 and 3, I would have to change version requirement to >= > 2.5... > > I know that some people still use PyUSB with 2.3 version, but I am > afraid I will have to break compatibility with versions 2.3 and 2.4... > :( > > Any suggestion? > > Wander > > 2010/2/1 Patrick Birnzain <pbi...@us...>: >> Alright, will do. >> I'll further investigate that and let you know if I find the problem. >> >> -- Patrick >> >> >> Wander Lairson wrote: >>> I haven't tested PyUSB with Python 3 yet. Therefore the most probable >>> is that this is an issue with PyUSB. Could you please open a bug in >>> the sf tracker? >>> >>> Wander >>> >>> 2010/2/1 Patrick Birnzain <pbi...@us...>: >>> >>>> Hi! >>>> >>>> I have a problem with PyUSB and Python 3: >>>> Everything seems to run fine with Python 2.6, but when I'm using Python >>>> 3.1, an ImportError is raised when I try to import any part of PyUSB: >>>> >>>> >>>>>>> import usb.core >>>>>>> >>>> Traceback (most recent call last): >>>> File "<stdin>", line 1, in <module> >>>> File "/usr/local/lib/python3.1/dist-packages/usb/__init__.py", line >>>> 24, in <module> >>>> from legacy import * >>>> ImportError: No module named legacy >>>> >>>> By running "python -v -v" and "python3 -v -v", I found that Python 3 is >>>> not recursing into dist-packages/usb when it's looking for legacy.py, >>>> while 2.6 does. >>>> Is this a bug in the v3 __init__.py or is something wrong with my Python >>>> 3 setup? >>>> >>>> -- Patrick >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> The Planet: dedicated and managed hosting, cloud storage, colocation >>>> Stay online with enterprise data centers and the best network in the business >>>> Choose flexible plans and management services without long-term contracts >>>> Personal 24x7 support from experience hosting pros just a phone call away. >>>> http://p.sf.net/sfu/theplanet-com >>>> _______________________________________________ >>>> Pyusb-users mailing list >>>> Pyu...@li... >>>> https://lists.sourceforge.net/lists/listinfo/pyusb-users >>>> >>>> >>>> >>> >>> ------------------------------------------------------------------------------ >>> The Planet: dedicated and managed hosting, cloud storage, colocation >>> Stay online with enterprise data centers and the best network in the business >>> Choose flexible plans and management services without long-term contracts >>> Personal 24x7 support from experience hosting pros just a phone call away. >>> http://p.sf.net/sfu/theplanet-com >>> _______________________________________________ >>> Pyusb-users mailing list >>> Pyu...@li... >>> https://lists.sourceforge.net/lists/listinfo/pyusb-users >>> >>> >> >> > |