FalkTannhaeuser / python-onvif-zeep

ONVIF Client Implementation in Python 2+3 (using https://github.com/mvantellingen/python-zeep instead of suds as SOAP client)
MIT License
428 stars 140 forks source link

NotImplementedError: AnySimpleType.pytonvalue() not implemented #4

Open LegionFu opened 7 years ago

LegionFu commented 7 years ago

Here is my code(Run with python 3.6 and python-onvif-0.2.0 ): from onvif import ONVIFCamera, ONVIFError mycam = ONVIFCamera('192.168.1.64', 80, 'admin', 'admin12345', 'C:\ProgramData\Anaconda3\Lib\site-packages\onvif-0.2.0-py3.6.egg\wsdl') media = mycam.create_media_service() media_profile = media.GetProfiles()[0]

And what I get: 1 2

How can i fixed it?

FalkTannhaeuser commented 6 years ago

I can not reproduce this problem... Questions:

FalkTannhaeuser commented 6 years ago

Another question: Are you able to run your test with the upstream version under Python 2.7? Since you seem to use Anaconda 3, you could:

What happens if you run your test under this setting?

LegionFu commented 6 years ago

I have installed python 2.7 , And it running without any problem, So i think this problem has nothing to do with my camera (Actually... i don't know my camera model number (ˉ▽ ̄~))

FalkTannhaeuser commented 6 years ago

Did you try with the last version, which can be installed through pip install onvif_zeep and which is supposed to place the wsdl directory into the right destination folder e.g. C:\ProgramData\Anaconda3\Lib\site-packages? With this version, you should be able to do simply mycam = ONVIFCamera('192.168.1.64', 80, 'admin', 'admin12345') i.e. you don't need to pass the wsdl directory as parameter...

LegionFu commented 6 years ago

I tried the last version , and initialize an ONVIFCamera instance by mycam = ONVIFCamera('192.168.1.64', 80, 'admin', 'admin12345')

But when i running media_profile = media.GetProfiles() , I got the same error image

happycorsair commented 6 years ago

Still exists :(

iomihai commented 6 years ago

I got around this by using the fix I found here mvantellingen/python-zeep#418

I monkey patched zeep:

import zeep
from onvif import ONVIFCamera, ONVIFService

def zeep_pythonvalue(self, xmlvalue):
    return xmlvalue

zeep.xsd.simple.AnySimpleType.pythonvalue = zeep_pythonvalue

It's not very nice but it works for me.

happycorsair commented 6 years ago

@iomihai, thanks a lot! Works like a charm. You've saved tons of my time! Thanks, thanks, thanks!

But anyway, I'll try to investigate this problem later...

peermaniak commented 6 years ago

Same problem on the onvif GetProfiles() call. Interesting though I have no issues on the Panasonic and Sony cameras, but only on a Honeywell (exactly the same code, zeep version 2.5.0).

tomdoughty62 commented 6 years ago

Had the same issue on Python3.6.5. Thanks to @iomihai for providing that fix.

vivekbdh commented 5 years ago

where to append exactly patch ? I'm simply executing rotate_image.py from example folder and getting above error.

tsdrm commented 5 years ago

I got around this by using the fix I found here mvantellingen/python-zeep#418

I monkey patched zeep:

import zeep
from onvif import ONVIFCamera, ONVIFService

def zeep_pythonvalue(self, xmlvalue):
    return xmlvalue

zeep.xsd.simple.AnySimpleType.pythonvalue = zeep_pythonvalue

It's not very nice but it works for me.

It's simple but so cool~~