[Mosquitto-users] unicode strings

2013-02-11 Thread Alexander Bolotnov
While trying to send unicode strings to mosquitto with python client I get the following: TypeError: payload must be a string, bytearray, int, float or None. how do I then submit unicode data? Sasha Bolotnov www.bolotnov.info -- Mailing list: https://launchpad.net/~mosquitto-users Post to :

Re: [Mosquitto-users] unicode strings

2013-02-11 Thread Roger Light
Hi, I'm not near a computer right now, but can you tell me what version of python you are using and how you are creating the string? Thanks, Roger On Feb 11, 2013 6:48 PM, "Alexander Bolotnov" wrote: > While trying to send unicode strings to mosquitto with python client I get > the following:

Re: [Mosquitto-users] unicode strings

2013-02-11 Thread Alexander Bolotnov
Hi, I'm using 2.7 and it's a unicode string: u'привет' - I'm actually getting them from my gtalk_daemon type(message) will return unicode I'm now using a dirty walkaround: def send_message(self, topic, message): if type(message) == unicode: message = str(message).enc

Re: [Mosquitto-users] unicode strings

2013-02-11 Thread Roger Light
Hi > I'm now using a dirty walkaround: > > def send_message(self, topic, message): > if type(message) == unicode: > message = str(message).encode('string_escape') > result, some_number = Client.mc.publish(topic, message) mosquitto.py does actually support p

Re: [Mosquitto-users] unicode strings

2013-02-11 Thread Alexander Bolotnov
got you, so the following in publish(): if isinstance(payload, str) == True or isinstance(payload, bytearray) == True: local_payload = payload should actually be something like if payload and type(payload) in (str, unicode, bytearray): local_payload = payload I guess thanks,

Re: [Mosquitto-users] unicode strings

2013-02-11 Thread Roger Light
Exactly. Note that this will fail on python3 though, because "unicode" doesn't exist. On Mon, Feb 11, 2013 at 9:32 PM, Alexander Bolotnov wrote: > got you, so the following in publish(): > > if isinstance(payload, str) == True or isinstance(payload, bytearray) == > True: > local_paylo

Re: [Mosquitto-users] Best practices for tls_set in Python

2013-02-11 Thread Jack O'Connor
Thanks for the reply, and I meant to follow up sooner. Does that mean that every application that uses the SSL features of Mosquitto ships its own copy of the certs file? (And by extension, that every app is independently responsible for keeping that file up to date?) On Tue, Feb 5, 2013 at 6:02

Re: [Mosquitto-users] Best practices for tls_set in Python

2013-02-11 Thread Roger Light
Hi Jack, I've got a part written reply to you that I've not yet sent because I'm not happy with it. Sorry about that, I'll try and sort it out as soon as I can. Cheers, Roger On Mon, Feb 11, 2013 at 10:04 PM, Jack O'Connor wrote: > Thanks for the reply, and I meant to follow up sooner. Does th