3 Oct 15:15
Re: Data Transport between nodes
Erik Blankinship <erikb <at> mediamods.com>
2007-10-03 13:15:34 GMT
2007-10-03 13:15:34 GMT
On 10/3/07, Simon McVittie <simon.mcvittie <at> collabora.co.uk> wrote:
On Tue, 02 Oct 2007 at 17:43:41 -0400, Benjamin M. Schwartz wrote:
> I used these to send arbitrary bytes over the Tube, which only supports utf8.
This isn't actually true. If a D-Bus method is declared with signature 's'
(string) it only supports unicode or UTF-8 str objects. If no signature is
declared but you use a str argument, dbus-python will guess that you
wanted signature 's' and the string has to be UTF-8.
However, if your method is declared with signature 'ay' (byte array) you
can pass arbitrary binary data. You probably want to put
byte_arrays=True in the <at> method decorator, so the method will get its
input as a dbus.ByteArray (a subclass of str) rather than as a
dbus.Array of dbus.Bytes (subclasses of: a list of ints).
I hope this is a simple question: what is the preferred way to convert a file into a ByteArray for use with dBus?
_______________________________________________ Sugar mailing list Sugar <at> lists.laptop.org http://lists.laptop.org/listinfo/sugar
RSS Feed