import tzwin failed on Windows Python 2.x

Bug #1143880 reported by Tommy Alex
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
dateutil
Fix Released
Undecided
Unassigned

Bug Description

Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from dateutil.tzwin import tzwin
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\GNU\Python27\lib\site-packages\python_dateutil-2.1-py2.7.egg\dateutil\tzwin.py", line 4, in <module>
    import winreg
ImportError: No module named winreg
>>>

The _winreg module has been renamed to winreg in Python 3
but on python2.x, _winreg should be imported

this also make dateutil.tz.tzwin None

should import _winreg as winreg after the ImportError

Related branches

Revision history for this message
Antoine Brodin (antoine-m) wrote :

Hello,
I think that this patch is needed for winreg to work both on python 2 and 3.

Revision history for this message
ccanepa (ccanepacc) wrote :

Update 2014
The defect is still present in python-dateutil 2.2 and lp:dateutil rev 135

Merge proposal to fix the issue:
https://code.launchpad.net/~ccanepacc/dateutil/fix-py2X-tzwin-import/+merge/224594

Revision history for this message
jarondl (jarondl) wrote :

This was fixed on 2.3

Changed in dateutil:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.