Closed jlc59 closed 3 years ago
It seems you are using Python 2. Please use Python 3 to run it.
sudo apt install python3 python3-pip
sudo pip3 install enocean-mqtt
Assuming the response solved the issue.
Hi @romor I am experience basically the same issue. Here's what I did:
~/enocean-mqtt
and installed it.~/enocean-mqtt
I ran python3 enoceanmqtt/enoceanmqtt.py
and got the following error:andi@enocean2mqtt:~/enocean-mqtt$ python3 enoceanmqtt/enoceanmqtt.py
Traceback (most recent call last):
File "/home/andi/enocean-mqtt/enoceanmqtt/enoceanmqtt.py", line 13, in <module>
from enoeceanmqtt.communicator import Communicator
ModuleNotFoundError: No module named 'enoeceanmqtt'
I don't fully understand the error. In my view, enoceanmqtt
is indeed a module. Maybe Python's import system gets confused as the package enoceanmqtt
holds a module that is also called enoceanmqtt
?
What am I missing here?
How did you install the package, using pip
or using setup.py
? Can you post your install command?
python3 setup.py develop
Have you edited that line in your clone? The module name that Python is complaining about is enoeceanmqtt
which has a spelling error.
I did indeed edit the import statement because I encountered the import error in the first place. When turning it back to the original, I apparently introduced the typo.
I replaced it with the original line again, my working tree is clean.
andi@enocean2mqtt:~/enocean-mqtt/enoceanmqtt$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
Anyway, I do get the import error.
andi@enocean2mqtt:~/enocean-mqtt$ python3 ./enoceanmqtt/enoceanmqtt.py
Traceback (most recent call last):
File "/home/andi/enocean-mqtt/./enoceanmqtt/enoceanmqtt.py", line 13, in <module>
from enoceanmqtt.communicator import Communicator
File "/home/andi/enocean-mqtt/enoceanmqtt/enoceanmqtt.py", line 13, in <module>
from enoceanmqtt.communicator import Communicator
ModuleNotFoundError: No module named 'enoceanmqtt.communicator'; 'enoceanmqtt' is not a package
I still think that Python's import system may get confused by having a module called enoceanmqtt.py
as well as having a package called enoceanmqtt
.
I renamed enoceanmqtt.py
into main.py
for testing purposes.
andi@enocean2mqtt:~/enocean-mqtt$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
renamed: enoceanmqtt/enoceanmqtt.py -> enoceanmqtt/main.py
Now, I can run the script and the import error is gone.
Having said this, I am encountering the next issues.
/usr/lib/python3.11/html/parser.py:170: XMLParsedAsHTMLWarning: It looks like you're parsing an XML document using an HTML parser. If this really is an HTML document (maybe it's XHTML?), you can ignore or filter this warning. If it's XML, you should know that using an XML parser will be more reliable. To parse this document as XML, make sure you have the lxml package installed, and pass the keyword argument `features="xml"` into the BeautifulSoup constructor.
k = self.parse_starttag(i)
2024-06-16 20:31:36,800 INFO: Logging to file: /home/andi/enocean-mqtt/enoceanmqtt/../enoceanmqtt.log
2024-06-16 20:31:36,800 INFO: Loading config file /etc/enoceanmqtt.conf
Traceback (most recent call last):
File "/home/andi/enocean-mqtt/./enoceanmqtt/main.py", line 125, in <module>
main()
File "/home/andi/enocean-mqtt/./enoceanmqtt/main.py", line 110, in main
sensors, global_config = load_config_file(conf['config'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andi/enocean-mqtt/./enoceanmqtt/main.py", line 65, in load_config_file
new_sens[key] = int(config_parser[section][key], 0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 0: 'FEF9EB23'
FEF9EB23
is the ID of an Etalko FT55. I also tried a different ID for an Hoppe SecuSignal window handle with the same result.
This seems to be a new issue. Do you want me to open a new issue for this?
Hexadecimal sensor addresses should be prefixed with 0x
as shown in the sample configuration. From the code, in sensor definitions, it looks like all keys except command
, channel
and publish_json
are converted into integers.
Hello, I am fairly new to linux and Raspberry. I tried to install enocean-mqtt using the command line:
sudo pip install enocean-mqtt
Then I created the file:/etc/enoceanmqtt.conf
by copying and modifyingenoceanmqtt.conf.sample
from the github But when I want to run:enoceanmqtt
I get the following error:Traceback (most recent call last):
File "/home/pi/.local/bin/enoceanmqtt", line 6, in <module>
from enoceanmqtt.enoceanmqtt import main
File "/home/pi/.local/lib/python2.7/site-packages/enoceanmqtt/enoceanmqtt.py", line 13, in <module>
from enoceanmqtt.communicator import Communicator
ImportError: No module named communicator
Can you help me ? I apologize again for being new to Linux and Python. Thank you in advance
Icône de validation par la communauté