3

I need to work with API via wsdl and I'm trying to figure out how zeep module works. The module was installed with "pip install" and it shows the same error every time.

ImportError: cannot import name 'Client' from 'zeep'

from zeep import Client

client = Client('http://www.webservicex.net/ConvertSpeed.asmx?WSDL')
result = client.service.ConvertSpeed(
    100, 'kilometersPerhour', 'milesPerhour')

assert result == 62.137 ```
johnny k
  • 37
  • 1
  • 6
  • is it possible that yo have multiple versions of python installed on your machine? and the pip that you used installed it onto a different python version? – static const Jun 17 '19 at 15:30
  • I got this in cmd: C:\WINDOWS\system32>python -V Python 3.7.1 – johnny k Jun 17 '19 at 15:57
  • Can you `import zeep`? The module also runs from the command line so to test you can try: `python -m zeep http://www.soapclient.com/xml/soapresponder.wsdl` to ensure it's installed – mgrollins Jun 17 '19 at 16:52
  • It is installed. I've checked that several times. python -m zeep http://www.soapclient.com/xml/soapresponder.wsdl runs correctly and I can't find any information about ImportError: cannot import name 'Client' from 'zeep' – johnny k Jun 18 '19 at 08:00

2 Answers2

1

First of all, do a pip freeze and make sure that zeep is installed.

If it's installed then make sure your source file is not named zeep.py or it will not work.

[edit]

From someone else on Github: "And ensure there's no zeep.pyc in the folder"

This leads me to believe that there should be no source file with the name zeep in the folder.

Link to GitHub discussion

Pieter
  • 2,188
  • 20
  • 27
0

You need to set permissions on the zeep library. Set permissions on the library directory in the site-packages directory.

chmod -R 777 zeep
Milija B
  • 11
  • 1
  • 1