Open LegionFu opened 7 years ago
I can not reproduce this problem... Questions:
C:\ProgramData\Anaconda3\wsdl
manually to C:\ProgramData\Anaconda3\Lib\site-packages\wsdl
respectively C:\ProgramData\Anaconda3\envs\<<<your Python env>>>\Lib\site-packages\wsdl
after installation of python-onvif-zeep. Then it should be sufficient to instantiate the Onvif camera using mycam = ONVIFCamera('192.168.1.64', 80, 'admin', 'admin12345')
i.e. without the 5th argument.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:
pip install --upgrade https://github.com/quatanium/python-onvif/archive/master.zip
into said Python 2.7 environment,C:\ProgramData\Anaconda3\envs\<<<Python 2.7 env>>>\wsdl
) to the right one (e.g. C:\ProgramData\Anaconda3\envs\<<<Python 2.7 env>>>\Lib\site-packages\wsdl
).What happens if you run your test under this setting?
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 (ˉ▽ ̄~))
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...
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
Still exists :(
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.
@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...
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).
Had the same issue on Python3.6.5. Thanks to @iomihai for providing that fix.
where to append exactly patch ? I'm simply executing rotate_image.py from example folder and getting above error.
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~~
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:
How can i fixed it?