例外:无法导入python-ntlm模块

时间:2013-08-15 22:36:57

标签: python soap suds

我正在使用suds 0.4并遇到以下错误,我在网上看到上面的问题已修复,因为0.3.8 ..所以我想知道这里有什么问题?

  File "script.py", line 532, in <module>
    prism = Prism('http://prism:8000/SearchService.svc?wsdl')
  File "script.py", line 31, in __init__
    self.CR_soapclient = Client(self.CR_url, transport=WindowsHttpAuthenticated(username=user, password=passwd))
  File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/client.py", line 112, in __init__
    self.wsdl = reader.open(url)
  File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/reader.py", line 152, in open
    d = self.fn(url, self.options)
  File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/wsdl.py", line 136, in __init__
    d = reader.open(url)
  File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/reader.py", line 79, in open
    d = self.download(url)
  File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/reader.py", line 95, in download
    fp = self.options.transport.open(Request(url))
  File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/transport/https.py", line 60, in open
    return  HttpTransport.open(self, request)
  File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/transport/http.py", line 62, in open
    return self.u2open(u2request)
  File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/transport/http.py", line 113, in u2open
    url = self.u2opener()
  File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/transport/http.py", line 127, in u2opener
    return u2.build_opener(*self.u2handlers())
  File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/transport/https.py", line 95, in u2handlers
    raise Exception("Cannot import python-ntlm module")
Exception: Cannot import python-ntlm module

Suds版

>>> import suds
>>> print suds.__version__
0.4

1 个答案:

答案 0 :(得分:0)

正如@PauloAlmeida在评论中所建议的那样,缺少 python-ntlm 。要使用pip进行安装,只需在OS shell中输入:

pip install python-ntlm

在Linux上,您可能需要sudo命令。

您也可以从https://pypi.python.org/pypi/python-ntlm下载该软件包。