-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ModuleNotFoundError: No module named 'pcap' #107
Comments
I managed to solve my problem. My weather station sent its data to
This stopped working as it appears pypcap is currently not available for python3.9 Now my setup is a follows: Local DNS redirects requests to
I then set up interceptor to listen rather than sniff (avoids use of pypcap completely!!!).
I am sure there is a simpler way but it works for me! |
@ear9mrn, great move. Thank you for sharing. I've converted to listen, seems to make more sense than sniffing packets. My setup I have configured the weather observer hardware to contact a local IP address to update the weather instead of weatherzone, http://x.x.x.x/weatherstation/updateweatherstation.php. This script then performs a HTTP get with the weather data to weatherzone - basically what the observer would have originally been doing before the PHP script was placed in the middle. I've configured interceptor to listen to 3001 (port 3000 was in use) and added another line in the PHP to request the same URL with the payload to 127.0.0.1:3001. Working great! My weewx interceptor config:
|
Trying to run on Debian 11 with Python 3.9.2 and get the following error.
ModuleNotFoundError: No module named 'pcap'
apt-cache search pcap | grep python
python3-impacket - Python3 module to easily build and dissect network protocols
python3-pcapy - Python interface to the libpcap packet capture library (Python 3)
python3-dpkt - Python 3 packet creation / parsing module for basic TCP/IP protocols
So installed python3-pcapy and changed:
import pcap
to
import pcapy
on line 465 of /usr/share/weewx/user/interceptor.py
and got the following error
File "/usr/share/weewx/user/interceptor.py", line 469, in __init__ weewx[2668625] CRITICAL weewx.engine: **** self.sniffer = pcap.pcapObject() weewx[2668625] CRITICAL weewx.engine: **** NameError: name 'pcap' is not defined
I then change the following two lines to match the new module:
self.sniffer = pcapy.pcapObject()
self.sniffer = pcapy.pcap(iface, snaplen, pval)
Then got more errors:
File "/usr/share/weewx/user/interceptor.py", line 475, in __init__ weewx[2670687] CRITICAL weewx.engine: **** self.sniffer = pcapy.pcap(iface, snaplen, pval) weewx[2670687] CRITICAL weewx.engine: **** AttributeError: module 'pcapy' has no attribute 'pcap' weewx[2670687] CRITICAL __main__: Unable to load driver: module 'pcapy' has no attribute 'pcap'
Now I am out of my depth. Any suggestions to get this working with python 3.9 and the "new" pcapy module or getting the "old" pcap module installed on this system?
Thanks,
Pete.
The text was updated successfully, but these errors were encountered: