hotplot / enviroplus-mqtt

A Python service for logging environmental data over MQTT
MIT License
31 stars 20 forks source link

Code will not run due to syntax error #1

Closed torarne closed 5 years ago

torarne commented 5 years ago

There is a bug in the following line:

        sys.exit(f"Connecting to the MQTT server failed: {logger.connection_error}")

A extra "f" needs to be removed from the arguments to sys.exit.

Thanks for the code which runs with Mosquitto in my setup!

hotplot commented 5 years ago

Hi @torarne

The syntax is correct for Python 3 - if you run using Python 2 then you will get the following error:

File "/usr/src/enviroplus-mqtt/src/main.py", line 47
    sys.exit(f"Connecting to the MQTT server failed: {logger.connection_error}")
                                                                              ^
SyntaxError: invalid syntax