Jump to content









Photo

Problem with Tutorial: How to send a stream using MQTT

Stream MQTT Python

  • Please log in to reply
1 reply to this topic

#1 olalie

olalie

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 11 February 2017 - 12:20 PM

Hi.

 

When trying to send data using this tutorial, I get the error: unorderable types: str() <= int().

To me it seems like a version problem (Python 2 vs 3); first if tls: when tls=None. Second, if I change '8883' to 8883, the publish.single function runs, but with the repeating error message [WinError 10054].

 

Trying to use clicarriots, I run into problems with the data type: TypeError: POST data should be bytes or an iterable of bytes. It cannot be of type str.

 

I hope to get it solved during next week, or I have to find another platform for my IT high school class doing a Raspberry Pi project.

 

Best regards

Ola Lie



#2 Yoleon

Yoleon

    Sugar Master

  • Members
  • PipPip
  • 27 posts

Posted 28 February 2017 - 12:32 PM

Hi Olalie,

 

If you are using the urllib of python 3 and higher you need to encode the data like that.

 

data = dumps(params).encode('ascii')

 

Try it and tell me.

 

Carriots Staff






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users