flagtrax
Posts: 38
Joined: Thu Mar 02, 2017 12:31 am

MQTT Python paho library for IoT

Sun Mar 04, 2018 3:36 pm

I really need steering. I have to say I am still new to Raspian, Linux type OS's in general, and the Raspberry pi. Not chronologically mind you but by lack of experience and time to work with it. In an effort to learn more, I'm currently trying to work through a project that was posted on You Tube (here https://www.youtube.com/watch?v=AUbFWSz8PjA )that uses a Raspberry Pi running mosquitto to communicate between clients on ESP8266's etc. The first module sets up the broker and I can publish and subscribe fine terminal windows. The second module adds a Python reporting/logging script requiring paho. There was not much instruction given as to how to incorporate the paho py libraries into the Pi environment. That being said I was able to install (I think) paho-mqtt. with a sudo pip3 install paho-mqtt command. I then tried to run the script from the project (downloaded from author's github) with sudo MQTT_logger.py. This generates an error "File "MQQT_logger.py, line 4, in <module> import paho.mqtt.client as mqtt Import Error: No module named paho..mqtt.client" I honestly don't know enough to ask the proper questions, I'm sure. But if anyone can steer me to an explanation of what I'm not doing right, I'd sure appreciated it.

User avatar
scruss
Posts: 2181
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: MQTT Python paho library for IoT

Sun Mar 04, 2018 4:24 pm

You should probably start your own thread in the Python forum, flagtrax.

I do have a presentation on MQTT, but even though I used Paho MQTT in Python, I didn't include the code in the preso. I don't remember it being too difficult, but your problem looks more like a typo than anything else.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

flagtrax
Posts: 38
Joined: Thu Mar 02, 2017 12:31 am

Re: MQTT Python paho library for IoT

Sun Mar 04, 2018 6:11 pm

Thanks for the reply scruss. Being so inexperienced in the world of Rpi and linux, and given the fact that the last time I used a cli was in the days of CP/M and DOS. I'm not quite sure where the problem lies. As far as typo's go, I can say I'm as prone as any to those, but in this case the error was generated by a script written by the author of the project that seemed to work for others. This project has been around for over a year with success for most who know what they're doing in the linux environment. I don't think I'm in that catagory :lol: but I'm trying :roll:

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 11657
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: MQTT Python paho library for IoT

Sun Mar 04, 2018 6:59 pm

scruss wrote:
Sun Mar 04, 2018 4:24 pm
You should probably start your own thread in the Python forum, flagtrax.

I do have a presentation on MQTT, but even though I used Paho MQTT in Python, I didn't include the code in the preso. I don't remember it being too difficult, but your problem looks more like a typo than anything else.
nope, he should have asked a moderator to split off his post, creating a second posting about the same subject is bad news, and will result in lots of work for moderators.

thread hijacking is also bad. even though the running thread is about the same subject, starting a new question isn't the way to do it, ask a new question in a new thread.

locked as a second thread exists. will delete this one soon.

Return to “Python”