Open elsampsa opened 9 years ago
Sorry for my late response. I'm in vacation... Thanks for your report :) I haven't run more than one instance in single process, but I think there is something wrong with suds cache. you can set the on_cache
to True
and try again:
mycam = onvif.ONVIFCamera(ip, 80, user, passwd, on_cache=True)
did you find a permanent solution ? I have similar sort of issue. I have Panasonic BL-VT164W & APKLINK HI3518e. Let's call them cam1 & cam2 I first tried using single ONVIFCamera instance & send their details (i.e ip,port, username & password) one by one. If I created cam1's instance & then cam2 -> it's OK But if I created cam2's instance & then tried for cam1, it would show error
File "C:\Python27\lib\site-packages\onvif-0.1.3-py2.7.egg\onvif\client.py", line 257, in __init__
File "C:\Python27\lib\site-packages\onvif-0.1.3-py2.7.egg\onvif\client.py", line 273, in update_xaddrs
capabilities = self.devicemgmt.GetCapabilities({'Category': 'All'})
File "C:\Python27\lib\site-packages\onvif-0.1.3-py2.7.egg\onvif\client.py", line 32, in wrapped
raise ONVIFError(err)
onvif.exceptions.ONVIFError: Sender not Authorized
[Finished in 4.5s]
Then I tried using 2 instances of ONVIFCamera class, Still the camera creation order matters,& shows gives me same error as above
I also meet 2 cameras problem when creating pullpoint.
The code is like below:
cam_list = {
"192.168.1.218" : CamInfo("192.168.1.218", "admin", "12345"),
"192.168.1.126" : CamInfo("192.168.1.126", "admin", "12345")
}
for cam in cam_list.values():
logger.info("Init ONVIF Camera, ip: {}, user: {}, password: {}".format(cam.ip, cam.user, cam.password))
cam.onvifCam = ONVIFCamera(cam.ip, 80, cam.user, cam.password, no_cache=True)
cam.pullpoint = cam.onvifCam.create_pullpoint_service()
When ran 2 camera instances, it would show error
Traceback (most recent call last): File "client.py", line 4, in
from audio_play_service import AudioService File "/home/pi/elevator_client/audio_play_service.py", line 1, in import cam_info File "/home/pi/elevator_client/cam_info.py", line 38, in cam.pullpoint = cam.onvifCam.create_pullpoint_service() File "/usr/local/lib/python2.7/dist-packages/onvif-0.2.0-py2.7.egg/onvif/client.py", line 425, in create_pullpoint_service return self.create_onvif_service('pullpoint', from_template, portType='PullPointSubscription') File "/usr/local/lib/python2.7/dist-packages/onvif-0.2.0-py2.7.egg/onvif/client.py", line 364, in create_onvif_service xaddr, wsdl_file = self.get_definition(name) File "/usr/local/lib/python2.7/dist-packages/onvif-0.2.0-py2.7.egg/onvif/client.py", line 356, in get_definition raise ONVIFError('Device doesn t support service: %s' % name) onvif.exceptions.ONVIFError: Unknown error: Device doesn
t support service: pullpoint
There is no problem to run one camera. Is there some fix for the code?
Hi,
Thanks for the nice module. It works like charm .. .. except when one is trying to connect to several (2+) cameras simultaneously.
The included python code demonstrates the problem.. just change the ip addresses in the main method's cams list.
When there is only one camera in the list it works ok (tried with both cameras individually), however, when there are two cameras in the list, it gives
(400, u'Bad Request')
while trying to get the media profiles for the second camera in the list.
The only way I can make two cameras work with this onvif module simultaneously, is to start them as individual processes (i.e. using python's multiprocessing module).
I'd please like to know why such behaviour and if it could be easily fixed.
Kind Regards,
Sampsa