问题
I'm using Ubuntu 11.04 (natty). I have been using Suds to consume a SOAP web service. Everything was working fine... until it wasn't. I can no longer import Suds. I've uninstalled and re-installed Suds from the Ubuntu repositories but still get the same import error (see IDLE traceback below). I'm using Python 2.7.1 and Suds 0.4.1-2. Does anyone have any ideas on how to solve this problem??
>>> import suds
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import suds
File "/usr/lib/pymodules/python2.7/suds/__init__.py", line 154, in <module>
import client
File "/usr/lib/pymodules/python2.7/suds/client.py", line 23, in <module>
import suds.metrics as metrics
File "/usr/lib/pymodules/python2.7/suds/metrics.py", line 23, in <module>
from logging import getLogger
ImportError: cannot import name getLogger
>>>
回答1:
logging
is a standard module of Python. There are several possible reasons why Python can't find it anymore:
- The is another
logging
module in the path (printsys.path
to get a list of paths Python will search) - Someone changed
PYTHONPATH
(the default Python search path) - Someone messed with the Python installation (deleted the
logging
module)
来源:https://stackoverflow.com/questions/6252660/python-suds-importerror-cannot-import-name-getlogger