Hello! I am a complete beginner with pythonanywhere (and kind of with python, too). I am working on a Internet of Things group project at school and I was thinking about using pythonanywhere as a server kind of thing that could take messages from my CloudMQTT message queue (that is already working) and make JSON out of them and save them to a database/file.
Maybe it is a stupid approach, we are learning ))
Anyways, I uploaded my python script (that connects to the MQTT queue) on pythonanywhere, installed and imported the paho.mqtt.client library (successfully) but when I run the script, it gives an error message:
13:53 ~ $ python2.7 mqtt.py
Traceback (most recent call last):
File "mqtt.py", line 37, in <module>
mqttc.connect("m20.cloudmqtt.com", "36348")
File "/home/PetrKryze/.local/lib/python2.7/site-packages/paho/mqtt/client.py", line 768, in connect
return self.reconnect()
File "/home/PetrKryze/.local/lib/python2.7/site-packages/paho/mqtt/client.py", line 895, in reconnect
sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0))
File "/usr/lib/python2.7/socket.py", line 571, in create_connection
raise err
socket.error: [Errno 111] Connection refused
Could anyone help or give some tips? Thanks alot!