I'm running Raspbian 10 (buster), fully patched as of today, on a
Raspberry Pi 4.
Manually testing weewx-interceptor with python2 works fine, but it fails
when using Python 3. Since Python2 is no longer supported by the Python
developers and my WeeWx installation is running under Python3, I'm
hoping someone has an idea how to get this to work.
Python2:
PYTHONPATH=/usr/share/weewx python2 /usr/share/weewx/user/interceptor.py
--device=observer --mode=sniff --iface=wlan0 --filter="src 192.168.4.10
and dst port 80"
mapped packet: {'pressure': 30.05, 'outHumidity': 40.0, 'UV': 0.0,
'radiation': 26.79, 'rain': None, 'dateTime': 1642278699, 'windDir':
315.0, 'outTemp': 7.9, 'windSpeed': 8.1, 'inHumidity': 26.0, 'inTemp':
72.9, 'windGust': 9.2, 'usUnits': 1}
Python3:
PYTHONPATH=/usr/share/weewx python3 /usr/share/weewx/user/interceptor.py
--device=observer --mode=sniff --iface=wlan0 --filter="src 192.168.4.10
and dst port 80"
Exception in thread ServerThread:
Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/usr/share/weewx/user/interceptor.py", line 434, in run_server
self._server.run()
File "/usr/share/weewx/user/interceptor.py", line 490, in run
self.decode_ip_packet(0, pkt, ts)
File "/usr/share/weewx/user/interceptor.py", line 517, in
decode_ip_packet
(_timestamp, _pktlen, _fmt_bytes(data)))
File "/usr/share/weewx/user/interceptor.py", line 337, in _fmt_bytes
return ' '.join(['%02x' % ord(x) for x in data])
File "/usr/share/weewx/user/interceptor.py", line 337, in <listcomp>
return ' '.join(['%02x' % ord(x) for x in data])
TypeError: ord() expected string of length 1, but int found
Looking at the Github repo for interceptor shows that it hasn't been
updated in a couple of years
(
https://github.com/matthewwall/weewx-interceptor). Is the project
still being maintained?
It looks like "kq6up" filed issue #90 on 18 Dec 2020 with the same
problem that I am seeing, but no response to their posting.
https://github.com/matthewwall/weewx-interceptor/issues/90
A few of the other comments have said to install the python-pypcap
package instead of the python-libpcap, but that made no change on my system.
Others have mentioned installing with "pip3 install pycap" instead of
the apt package, but that also made no difference.
Anyone have any thoughts on this?
Thank you,
-Dj