Enviro + pimoroni unexpected keyword argument 'loglevel'

Hi to all, I’m trying to configure my ENVIRO+ from Pimoroni with Cayenne following this guide:
Adding Enviro+ with Cayenne - #4 by docnjt77” but when I try to launch the SendData.py (sudo python SendData.py) I receive this error:

Traceback (most recent call last):
File “SendData.py”, line 29, in
client.begin(MQTT_USERNAME, MQTT_PASSWORD, MQTT_CLIENT_ID, loglevel=logging.INFO)
TypeError: begin() got an unexpected keyword argument ‘loglevel’

This is the line 29:
client.begin(MQTT_USERNAME, MQTT_PASSWORD, MQTT_CLIENT_ID, loglevel=logging.INFO)

and on top of file “import logging” is explained;

otherwise if I delete “loglevel=logging.INFO” from the string, the script run correcty.

(client.begin(MQTT_USERNAME, MQTT_PASSWORD, MQTT_CLIENT_ID)

Someone can help me?
thanks in advance.
Simone

which python version are you using? you can remove that line, it is just to log the status.

Thanks for reply, I’m using Python 2.7.16.
What kind of status the log contains?

BR
Simone

the connection status , publish and subscribe messages.

1 Like

ok thanks, very kind :slight_smile:

1 Like

My light bulb went on :slight_smile: when you asked me what version of python i was using because i realized that using python 3 (python3 Send It.py) the log function works, thanks again

1 Like