weewx-interceptor not working since upgrade

836 views
Skip to first unread message

Chris Maness

unread,
Dec 11, 2020, 11:01:25 PM12/11/20
to weewx-user
I had wee-wx interceptor running on version 3.8.2, but since upgrading
to 4.2.0 and upgrading the weewx-interceptor, I cannot get it to work.
When I run by hand to debug, I get the following error:

/home/pi/weewx-interceptor-master/bin/user# python interceptor.py
--device=ecowitt-client --mode=sniff --iface=wlan0 --filter="src
10.3.141.99 and dst port 80"

Traceback (most recent call last):

File "interceptor.py", line 302, in <module>

import weewx.drivers

ImportError: No module named weewx.drivers

Any suggestions on how to fix this?

Thanks, Chris KQ6UP

gjr80

unread,
Dec 11, 2020, 11:29:42 PM12/11/20
to weewx-user
Hi,

Python needs to know where to find the WeeWX python files. If you have a look through the interceptor readme and scroll down to the section titled How to run the driver directly it tells you what you need to do.

Gary

ch...@chrismaness.com

unread,
Dec 12, 2020, 11:01:33 AM12/12/20
to weewx...@googlegroups.com

When I try the whole command as root I get (note I will change the flags after I get it to find the file):

PYTHONPATH=bin python bin/user/interceptor.py --device=acurite-bridge --mode=sniff --iface=eth0 --filter="src 192.168.0.4 and dst port 80"
python: can't open file 'bin/user/interceptor.py': [Errno 2] No such file or directory

That is why I executed the way I did.  Maybe this is what is going on.  Not sure why this does not work.

Thanks,

Chris KQ6UP

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/89cf1d35-dbdd-4fc2-b845-96a3834dd627n%40googlegroups.com.
OpenPGP_0x55BE65AD1B41D696.asc
OpenPGP_signature

gjr80

unread,
Dec 12, 2020, 5:48:11 PM12/12/20
to weewx-user
Apologies, I have given you incomplete info. The command provided under the How to run the driver directly section requires you to be in the WeeWX root directory (nominally /home/weewx for a setup.py install or /usr/share/weewx for a package install). I thought that was stated in the readme but it seems it is not, it is only stated in the comments in the actual driver file.

Try cd'ing into /home/weewx or /usr/share/weewx (as applicable) and then execute the command.

My preference when running WeeWX drivers directly is to specify the paths in full, eg:

$ PYTHONPATH=/home/weewx/bin python /home/weewx/user/driver_file_name.py

It's a little more typing, is more specific and requires you to know exactly where things are on your system but it has the advantage of being 'present working directory' agnostic.

Gary

ch...@chrismaness.com

unread,
Dec 12, 2020, 6:23:56 PM12/12/20
to weewx...@googlegroups.com

There is no "bin" directory in /home/weewx or /usr/share/weewx.  I don't have a /home/weewx directory, but I do /usr/share/weewx directory.

I have "tree'd" the weewx folder. 

weewx/
├── daemon.py
├── __pycache__
│   ├── daemon.cpython-37.pyc
│   └── six.cpython-37.pyc
├── schemas
│   ├── __init__.py
│   ├── __pycache__
│   │   ├── __init__.cpython-37.pyc
│   │   └── wview_extended.cpython-37.pyc
│   ├── wview_extended.py
│   └── wview.py
├── six.py
├── user
│   ├── extensions.py
│   ├── __init__.py
│   ├── installer
│   │   └── interceptor
│   │       └── install.py
│   ├── interceptor.py
│   └── __pycache__
│       ├── extensions.cpython-37.pyc
│       ├── __init__.cpython-37.pyc
│       └── interceptor.cpython-37.pyc
├── weecfg
│   ├── config.py
│   ├── database.py
│   ├── extension.py
│   ├── __init__.py
│   └── __pycache__
│       ├── config.cpython-37.pyc
│       ├── extension.cpython-37.pyc
│       └── __init__.cpython-37.pyc
├── wee_config
├── wee_database
├── weedb
│   ├── __init__.py
│   ├── mysql.py
│   ├── __pycache__
│   │   ├── __init__.cpython-37.pyc
│   │   └── sqlite.cpython-37.pyc
│   └── sqlite.py
├── wee_debug
├── wee_device
├── wee_extension
├── wee_import
├── weeimport
│   ├── csvimport.py
│   ├── cumulusimport.py
│   ├── __init__.py
│   ├── wdimport.py
│   ├── weathercatimport.py
│   ├── weeimport.py
│   └── wuimport.py
├── weeplot
│   ├── genplot.py
│   ├── __init__.py
│   ├── __pycache__
│   │   ├── genplot.cpython-37.pyc
│   │   ├── __init__.cpython-37.pyc
│   │   └── utilities.cpython-37.pyc
│   └── utilities.py
├── wee_reports
├── weeutil
│   ├── config.py
│   ├── ftpupload.py
│   ├── __init__.py
│   ├── logger.py
│   ├── log.py
│   ├── Moon.py
│   ├── __pycache__
│   │   ├── config.cpython-37.pyc
│   │   ├── __init__.cpython-37.pyc
│   │   ├── logger.cpython-37.pyc
│   │   ├── Moon.cpython-37.pyc
│   │   ├── Sun.cpython-37.pyc
│   │   └── weeutil.cpython-37.pyc
│   ├── rsyncupload.py
│   ├── Sun.py
│   ├── timediff.py
│   └── weeutil.py
├── weewx
│   ├── accum.py
│   ├── almanac.py
│   ├── cheetahgenerator.py
│   ├── crc16.py
│   ├── defaults.py
│   ├── drivers
│   │   ├── acurite.py
│   │   ├── cc3000.py
│   │   ├── fousb.py
│   │   ├── __init__.py
│   │   ├── __pycache__
│   │   │   ├── __init__.cpython-37.pyc
│   │   │   └── simulator.cpython-37.pyc
│   │   ├── simulator.py
│   │   ├── te923.py
│   │   ├── ultimeter.py
│   │   ├── vantage.py
│   │   ├── wmr100.py
│   │   ├── wmr200.py
│   │   ├── wmr300.py
│   │   ├── wmr9x8.py
│   │   ├── ws1.py
│   │   ├── ws23xx.py
│   │   └── ws28xx.py
│   ├── engine.py
│   ├── filegenerator.py
│   ├── imagegenerator.py
│   ├── __init__.py
│   ├── manager.py
│   ├── __pycache__
│   │   ├── accum.cpython-37.pyc
│   │   ├── almanac.cpython-37.pyc
│   │   ├── cheetahgenerator.cpython-37.pyc
│   │   ├── defaults.cpython-37.pyc
│   │   ├── engine.cpython-37.pyc
│   │   ├── imagegenerator.cpython-37.pyc
│   │   ├── __init__.cpython-37.pyc
│   │   ├── manager.cpython-37.pyc
│   │   ├── qc.cpython-37.pyc
│   │   ├── reportengine.cpython-37.pyc
│   │   ├── restx.cpython-37.pyc
│   │   ├── station.cpython-37.pyc
│   │   ├── tags.cpython-37.pyc
│   │   ├── units.cpython-37.pyc
│   │   ├── uwxutils.cpython-37.pyc
│   │   ├── wxformulas.cpython-37.pyc
│   │   ├── wxservices.cpython-37.pyc
│   │   ├── wxxtypes.cpython-37.pyc
│   │   └── xtypes.cpython-37.pyc
│   ├── qc.py
│   ├── reportengine.py
│   ├── restx.py
│   ├── station.py
│   ├── tags.py
│   ├── units.py
│   ├── uwxutils.py
│   ├── wxengine.py
│   ├── wxformulas.py
│   ├── wxmanager.py
│   ├── wxservices.py
│   ├── wxxtypes.py
│   └── xtypes.py
├── weewxd
└── wunderfixer

OpenPGP_0x55BE65AD1B41D696.asc
OpenPGP_signature

gjr80

unread,
Dec 12, 2020, 6:34:42 PM12/12/20
to weewx-user
try

$ PYTHONPATH=/usr/share/weewx python /usr/share/weewx/user/interceptor.py .....

Gary

Christopher Maness

unread,
Dec 12, 2020, 6:38:29 PM12/12/20
to weewx...@googlegroups.com

It got one line further, lol:

root@raspberrypi:/usr/share/weewx# PYTHONPATH=/usr/share/weewx python /usr/share/weewx/user/interceptor.py  --device=acurite-bridge --mode=sniff --iface=wlan0 --filter="src 10.3.141.99 and dst port 80"


Traceback (most recent call last):

  File "/usr/share/weewx/user/interceptor.py", line 303, in <module>
    import weeutil.weeutil
  File "/usr/share/weewx/weeutil/weeutil.py", line 26, in <module>
    from weeutil.config import accumulateLeaves, search_up
  File "/usr/share/weewx/weeutil/config.py", line 11, in <module>
    import configobj
ImportError: No module named configobj

OpenPGP_0x55BE65AD1B41D696.asc
OpenPGP_signature

gjr80

unread,
Dec 12, 2020, 7:43:06 PM12/12/20
to weewx-user
When you start WeeWX after your upgrade what version of python is it run under? python 2 or python 3? You will find this in the startup portion of the log when starting WeeWX. Assuming you installed the dependencies for this version of python you will need to specify the version of python used when running the interceptor directly. If WeeWX is being run under python2 replace python in the above command with python2, if WeeWX is being run under python3 replace python in the above command with python3.

Gary

ch...@chrismaness.com

unread,
Dec 12, 2020, 8:38:58 PM12/12/20
to weewx...@googlegroups.com

Ok, got a little further.

Dec 12 17:04:24 raspberrypi weewx[18797] INFO __main__: Using Python 3.7.3 (default, Jul 25 2020, 13:03:44) #012[GCC 8.3.0]

root@raspberrypi:/home/pi# PYTHONPATH=/usr/share/weewx python3.7 /usr/share/weewx/user/interceptor.py  --device=acurite-bridge --mode=sniff --iface=wlan0 --filter="src 10.3.141.99 and dst port 80"


Traceback (most recent call last):

  File "/usr/share/weewx/user/interceptor.py", line 2664, in <module>
    address=options.addr, port=options.port)
  File "/usr/share/weewx/user/interceptor.py", line 1002, in __init__
    AcuriteBridge.Parser(), handler=AcuriteBridge.Handler, **stn_dict)
  File "/usr/share/weewx/user/interceptor.py", line 427, in __init__
    iface, pcap_filter, promiscuous)
  File "/usr/share/weewx/user/interceptor.py", line 465, in __init__
    import pcap
ModuleNotFoundError: No module named 'pcap'

@@@@@I have this installed, but I guess it is not finding it:@@@@@@

root@raspberrypi:/home/pi# sudo apt-get install python-libpcap
Reading package lists... Done
Building dependency tree      
Reading state information... Done
python-libpcap is already the newest version (0.6.4-1).
The following packages were automatically installed and are no longer required:
  lxplug-volume openbsd-inetd tcpd
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Thanks,

Chris KQ6UP

OpenPGP_0x55BE65AD1B41D696.asc
OpenPGP_signature

gjr80

unread,
Dec 12, 2020, 8:56:33 PM12/12/20
to weewx-user
I believe that installing via apt makes pcap available under python2 only. Try installing pypcap using pip3:

$ sudo pip3 install pypcap

Note that you may need ot install pip3 if not already installed:

$ sudo apt-get install python3-pip

Gary

ch...@chrismaness.com

unread,
Dec 12, 2020, 9:04:38 PM12/12/20
to weewx...@googlegroups.com

Done, same error.

OpenPGP_0x55BE65AD1B41D696.asc
OpenPGP_signature
Message has been deleted

gjr80

unread,
Dec 12, 2020, 9:25:22 PM12/12/20
to weewx-user
Can you provide the console output from when you installed pypcap? Under some circumstances pip installs locally in a directory that is not in the path when python is run. If you can't uninstall using:

$ sudo pip3 uninstall pypcap

and then install again and capture and post the console output.

Gary

ch...@chrismaness.com

unread,
Dec 12, 2020, 9:29:38 PM12/12/20
to weewx...@googlegroups.com

pip3 install pypcap
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pypcap
  Downloading
    https://files.pythonhosted.org/packages/12/71/a689ca8c6ef4570e105efdc6b46d4ac16cdef7af36a8fbfaff0f6fa2b754/pypcap-1.2.3.tar.gz
    (136kB) 100% |████████████████████████████████| 143kB 1.4MB/s
    Complete output from command python setup.py egg_info: pcap.h not
    found
   
    ---------------------------------------- Command "python setup.py
egg_info" failed with error code 1 in /tmp/pip-install-yuo7efq5/pypcap/

OpenPGP_0x55BE65AD1B41D696.asc
OpenPGP_signature

gjr80

unread,
Dec 12, 2020, 9:38:47 PM12/12/20
to weewx-user
I don't believe having an error code is a good sign. A bit of googling indicates that it could be a version issue with setuptools, but we have about reached the limit of my pip knowledge. Tom or some other pip expert might be able to help.

Gary

ch...@chrismaness.com

unread,
Dec 12, 2020, 10:12:14 PM12/12/20
to weewx...@googlegroups.com

Thank you for your help,

Chris KQ6UP

OpenPGP_0x55BE65AD1B41D696.asc
OpenPGP_signature

ch...@chrismaness.com

unread,
Dec 13, 2020, 10:04:32 AM12/13/20
to gjr80, weewx-user

pip3 was missing some file.  I ripped out pypthon3 and reinstalled everything.  Then pip3 installed

pip3 install pypcap

I think was also missing libpcap-dev and should have been installed by dependency .  So basically wound up in some DLL hell.

Seemed to resolve something as the diagnostic test runs with this output:

PYTHONPATH=/usr/share/weewx python3.7 /usr/share/weewx/user/interceptor.py  --device=wu-client --mode=sniff --iface=wlan0 --filter="src 10.3.141.99 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

Hopefully this output will be helpful.

Thanks,

Chris KQ6UP

On 12/12/20 6:38 PM, gjr80 wrote:
pip3 install pypcap
OpenPGP_0x55BE65AD1B41D696.asc
OpenPGP_signature

Travis M

unread,
Jun 23, 2021, 5:12:19 PM6/23/21
to weewx-user
Did you ever get a resolution on this? I've been fighting it for some time now with my Google-fu pretty much leading me back here.
Reply all
Reply to author
Forward
0 new messages