quatanium / python-onvif

ONVIF Client Implementation in Python
MIT License
474 stars 321 forks source link

onvif-cli broken on Ubuntu 15.10 #27

Open dghodgson opened 8 years ago

dghodgson commented 8 years ago

Same issue when Installed from source or Pypi

ubuntu@ubuntu:~#  onvif-cli --host 192.168.1.100 -u admin -a 123456 -w /etc/onvif/wsdl/
Traceback (most recent call last):
  File "/usr/local/bin/onvif-cli", line 9, in <module>
    load_entry_point('onvif==0.1.3', 'console_scripts', 'onvif-cli')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 558, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2355, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2361, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python2.7/dist-packages/onvif-0.1.3-py2.7.egg/onvif/__init__.py", line 1, in <module>
    from onvif.client import ONVIFService, ONVIFCamera, SERVICES
  File "/usr/local/lib/python2.7/dist-packages/onvif-0.1.3-py2.7.egg/onvif/client.py", line 17, in <module>
    from suds_passworddigest.token import UsernameDigestToken
  File "/usr/local/lib/python2.7/dist-packages/suds_passworddigest-0.1.2-py2.7.egg/suds_passworddigest/token.py", line 8, in <module>
    from suds.sax.date import UTC
ImportError: cannot import name UTC

From what I can tell, the suds-passworddigest package isn't available on Ubuntu 15.10. In addition, it looks as though the suds package has been deprecated.

jenswes commented 8 years ago

Hi I've got the same error in debian jessi 8.4

to solve this edit /usr/local/lib/python2.7/dist-packages/suds_passworddigest/token.py

and changed the following: -from suds.sax.date import UTC +from suds.sax.date import DateTime, UtcTimezone

onvif-cli argument --host is required usage: onvif-cli [-h] --host HOST [--port PORT] -u USER -a PASSWORD [-w WSDL] [-e ENCRYPT] [-v] [--cache-location CACHE_LOCATION] [--cache-duration CACHE_DURATION] [service] [operation] [params]

in my ubuntu installation it was ~/.local/lib/python2.7/site-packages/suds_passworddigest/token.py

i hope it helps...

jens

jenswes commented 8 years ago

But it will not work:

python --version Python 2.7.10

onvif-cli -v -u 'user' -a 'password' --host 'IP.ADDR' --port 8899 -w /home/jens/src/onvif/python-onvif/wsdl

Traceback (most recent call last): File "/usr/local/bin/onvif-cli", line 9, in load_entry_point('onvif==0.1.3', 'console_scripts', 'onvif-cli')() File "/usr/local/lib/python2.7/dist-packages/onvif-0.1.3-py2.7.egg/onvif/cli.py", line 160, in main cli.setup(args) File "/usr/local/lib/python2.7/dist-packages/onvif-0.1.3-py2.7.egg/onvif/cli.py", line 39, in setup args.wsdl, encrypt=args.encrypt) File "/usr/local/lib/python2.7/dist-packages/onvif-0.1.3-py2.7.egg/onvif/client.py", line 227, in init self.update_xaddrs() File "/usr/local/lib/python2.7/dist-packages/onvif-0.1.3-py2.7.egg/onvif/client.py", line 237, in update_xaddrs capabilities = self.devicemgmt.GetCapabilities({'Category': 'All'}) File "/usr/local/lib/python2.7/dist-packages/onvif-0.1.3-py2.7.egg/onvif/client.py", line 31, in wrapped raise ONVIFError(err) onvif.exceptions.ONVIFError: Unknown error: global name 'self' is not defined

On CentOS 6 with python --version Python 2.6.6

it works onvif-cli -u 'jens' -a 'jens' --host 'Cam.IP' --port 8899 -w /root/src/python-onvif/wsdl ONVIF >>> jens

eLvErDe commented 8 years ago

Hello,

It took me some time to figure out but the problem actually comes from Debian SUDS package that break the API by introducing proper timezone handling.

PR has been sent and merged already: https://github.com/suvit/suds-passworddigest/pull/4

I also created Debian's package available here: https://cloud.le-vert.net/public.php?service=files&t=7f106d986b07256ba7efcf88e26788f6

They need suds-passworddigest package from here: https://cloud.le-vert.net/public.php?service=files&t=665bdfb0abe467cf6b6a28d50370dc65