NoneType exception when using oonicli
At 2013-09-04 13:04:23 None wrote: ooni-probe does not work with basic deck or command line nettest. it fails like so:
~/code/ooni-probe$ bin/ooniprobe -i ~/.ooni/decks/basic.deck Log opened. WARNING: Failed to execute tcpdump. Check it is installed and in the PATH [!] pypcap or dnet not installed. Certain tests may not work. [D] Tor is not running. Skipping IP lookup via Tor. [D] Cannot determine the probe IP address with a traceroute, becase of insufficient priviledges Looking up your IP address via torproject Starting factory <twisted.web.client._HTTP11ClientFactory instance at 0x3775560> Traceback (most recent call last): File "bin/ooniprobe", line 17, in runWithDirector() File "/home/ooni/code/ooni-probe/ooni/oonicli.py", line 136, in runWithDirector deck = Deck() File "/home/ooni/code/ooni-probe/ooni/deck.py", line 80, in init cache_path = os.path.join(cached_deck_dir, deck_hash) File "/home/ooni/.virtualenvs/ooni/lib/python2.7/posixpath.py", line 75, in join if b.startswith('/'): AttributeError: 'NoneType' object has no attribute 'startswith'
Likewise:
~/code/ooni-probe$ bin/ooniprobe ~/.ooni/nettests/blocking/tcpconnect.py -f ~/code/ooni-probe/one Log opened. WARNING: Failed to execute tcpdump. Check it is installed and in the PATH [!] pypcap or dnet not installed. Certain tests may not work. [D] Tor is not running. Skipping IP lookup via Tor. [D] Cannot determine the probe IP address with a traceroute, becase of insufficient priviledges Looking up your IP address via maxmind Starting factory <twisted.web.client._HTTP11ClientFactory instance at 0x3cb04d0> Traceback (most recent call last): File "bin/ooniprobe", line 17, in runWithDirector() File "/home/ooni/code/ooni-probe/ooni/oonicli.py", line 136, in runWithDirector deck = Deck() File "/home/ooni/code/ooni-probe/ooni/deck.py", line 80, in init cache_path = os.path.join(cached_deck_dir, deck_hash) File "/home/ooni/.virtualenvs/ooni/lib/python2.7/posixpath.py", line 75, in join if b.startswith('/'): AttributeError: 'NoneType' object has no attribute 'startswith'
It looks like this is caused by a missing "deck_hash" argument to the Deck constructor; but not all decks will have hashes because a deck may be assembled at runtime as well as loaded from disk.
One solution would be to make the deck id or deck_hash a property such that:
- a deck can generate a corresponding yaml file (and optionally write it to disk, if a file on disk does not already exist)
- the sha256sum of the yaml output is the deck id
This issue was automatically migrated from github issue https://github.com/TheTorProject/ooni-probe/issues/180