My guess is that you're using Debian testing. The Debian package for mosquitto finally got upgraded from the old 0.15 to 1.2.1. One of the changes with 1.0 was a rejig of the API.
This means that your call
mqttc.connect(broker, 1883, 60, True)
should become
mqttc.connect(broker, 1883, 60)
The True
from the original call was setting the clean_session
parameter, which is deemed to be a property of the client (so has moved to the Mosquitto()
constructor) rather than a connection parameter.
Version 1.2 added the bind_address
parameter to the connect()
call. This expects a string, hence your error about needing a string but having a bool.
Something else you might find useful - if you don't specify a client id (python_sub
in your example), then the mosquitto module will generate a random id for you and give a smaller chance of there being a collision on the broker.