You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I was trying to use paho.mqtt.client to receive messages with the following code:
import paho.mqtt.client as mqtt
import paho.mqtt.enums as mqtt_enums
api_version = mqtt_enums.CallbackAPIVersion(2)
client = mqtt.Client(api_version, client_id='client_id')
I was using virtual enviroments, and the script was working.
I added it to supervisor, using the pyhton path inside the .venv folder /home/pi/tank_level/.venv/bin/python /home/pi/tank_level/tank_level.py
and I started getting the following error message:
File "/home/pi/tank_level/tank_level.py", line 9, in <module>
import paho.mqtt.enums as mqtt_enums
ModuleNotFoundError: No module named 'paho.mqtt.enums'
The supervisor command was checked, and it worked fine outside supervisor (without the virtual enviroment activated)
Finally I reverted to v 1.6.1, changed the syntaxis and it is working perfectly.
Environment (please complete the following information):
OS: Raspbian on R Pi 3+
Version : 2.1.0
Final comment
There appears to be something wrong with the import of the paho.mqtt.enums library. I tried several ways of importing it, but none worked inside supervisor.
It is strange that the import paho.mqtt.client works fine inside supervisor, but the next line import paho.mqtt.enums gives an error.
I suggest to give api_version a default value, or to make CallbackAPIVersion easier to find
The text was updated successfully, but these errors were encountered:
Getting the same issue in my raspberry pi environment as well, seems like the enums are not accessible for some reason.
Using version 2.1 of the library
Describe the bug
I was trying to use paho.mqtt.client to receive messages with the following code:
I was using virtual enviroments, and the script was working.
I added it to supervisor, using the pyhton path inside the .venv folder
/home/pi/tank_level/.venv/bin/python /home/pi/tank_level/tank_level.py
and I started getting the following error message:
The supervisor command was checked, and it worked fine outside supervisor (without the virtual enviroment activated)
Finally I reverted to v 1.6.1, changed the syntaxis and it is working perfectly.
Environment (please complete the following information):
OS: Raspbian on R Pi 3+
Version : 2.1.0
Final comment
There appears to be something wrong with the import of the paho.mqtt.enums library. I tried several ways of importing it, but none worked inside supervisor.
It is strange that the import paho.mqtt.client works fine inside supervisor, but the next line import paho.mqtt.enums gives an error.
I suggest to give api_version a default value, or to make CallbackAPIVersion easier to find
The text was updated successfully, but these errors were encountered: