sydspost / Domoticz-WiZ-connected-plugin

Domoticz WiZ connected plugin
MIT License
5 stars 6 forks source link

Scapy import problem on Windows #4

Closed LarsThunberg closed 2 years ago

LarsThunberg commented 2 years ago

Hi! I'm trying to use this Plugin on a Windows installation. It seems that scapy fail to be imported by the script. Scapy is installed according to the instruction on this site: https://scapy.readthedocs.io/en/latest/ ... structions

Any ideas how to setup this for running on a Windows PC?

/Lars

2021-10-18 18:59:44.178 Error: WiZ : (wiz) failed to load 'plugin.py', Python Path used was 'C:\Domoticz\plugins\Domoticz-WiZ-connected-plugin\;C:\Program Files (x86)\Python35-32\python35.zip;C:\Program Files (x86)\Python35-32\Lib\;C:\Program Files (x86)\Python35-32\DLLs\;C:\Domoticz;C:\Program Files (x86)\Python35-32;C:\Program Files (x86)\Python35-32\lib\site-packages'.
2021-10-18 18:59:44.178 Error: WiZ : (WiZ ) Module Import failed, exception: 'ImportError'
2021-10-18 18:59:44.179 Error: WiZ : (WiZ ) Module Import failed: ' Name: scapy'
2021-10-18 18:59:44.179 Error: WiZ : (WiZ ) Error Line details not available.
2021-10-18 18:59:44.179 Error: WiZ : (WiZ ) Exception traceback:
2021-10-18 18:59:44.179 Error: WiZ : (WiZ ) ----> Line 53 in 'C:\Domoticz\plugins\Domoticz-WiZ-connected-plugin\plugin.py', function <module>
sydspost commented 2 years ago

Are you sure than scapy is installed in 'C:\Program Files (x86)\Python35-32\lib\site-packages' and not in 'C:\Program Files (x86)\Python35-32\site-packages'

LarsThunberg commented 2 years ago

Hi and thank you for answer. Yes it is installed in 'C:\Program Files (x86)\Python35-32\lib\site-packages'

sydspost commented 2 years ago

ImportError: No module.. found error happens when Python doesn't find your module. So, where does it look for modules?

On a command prompt start Python, enter the following code:

import os print (os.sys.path)

Verify 'C:\Program Files (x86)\Python35-32\lib\site-packages' is in that list. If not, append it

os.sys.path.append('C:\Program Files (x86)\Python35-32\lib\site-packages') and try to load it.

from scapy.all import *

If that still doesn't work, try re-installing the module with pip install scapy from command prompt

LarsThunberg commented 2 years ago

I actually got it working now by moving the directory structure up one level for scapy under 'C:\Program Files (x86)\Python35-32\lib\site-packages'. Do not why the installation added one extra folder in the beginning...

The now the plugin loads, next step is to configure. But this issue is solved.

Thank you very much for your help and time. regards Lars