Robs Blog

Blog containing all sorts of info and help from my day to day life


Mosquitto 1.0 python changes

Looks like there have been some changes to the Mosquitto v1.0.1 python libraries. So far only hit the one but it was quite a major one. The connect method has been changed. If you try and run your code you will get

Traceback (most recent call last):
File "", line 13, in <module>
mqttc.connect(broker, port, 60, True)
TypeError: connect() takes at most 4 arguments (5 given)

In 1.0 the connect function changed from:
def connect(self, hostname="localhost", port=1883, keepalive=60, clean_session=True):
def connect(self, host, port=1883, keepalive=60):

So all it needed was to remove the true flag from the connect statement and then the script worked.

August 17th, 2012 by robconvery
Posted in linux

One Response to “Mosquitto 1.0 python changes”

  1. Pink Says:

    Thanks for shirang. Always good to find a real expert.

Leave a Reply