python: ImportError: cannot import name timegm
Sziasztok!
A mechanize modult akarom használni Python alatt (Ubuntu 12.04.1), de egy egysoros script, ami csak azt tartalmazza, hogy:
import mechanize
már ilyen hibát dob.
File "/usr/local/lib/python2.7/dist-packages/mechanize/_util.py", line 59, in
from calendar import timegm
ImportError: cannot import name timegm
Én értem, hogy a calendar.py-t keresi a sys.path -ban, és onnan próbálja a timegm függvényt betölteni. Viszont a sys.path-ban megvan az a dir is, ahol a calendar.py tartózkodik (/usr/lib/python2.7).
$ python
Python 2.7.3 (default, Aug 1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.path
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/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']
Mi lehet a gond? Nem hiszem, hogy a mechanize a bűnös, mert szimplán kiadva a from calendar import timegm
parancsot is hibát okoz.
- Tovább (python: ImportError: cannot import name timegm)
- 5311 megtekintés