On 10/3/07, <b class="gmail_sendername">Simon McVittie</b> &lt;<a href="mailto:simon.mcvittie@collabora.co.uk">simon.mcvittie@collabora.co.uk</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tue, 02 Oct 2007 at 17:43:41 -0400, Benjamin M. Schwartz wrote:<br>&gt;&nbsp;&nbsp;I used these to send arbitrary bytes over the Tube, which only supports utf8.<br><br>This isn&#39;t actually true. If a D-Bus method is declared with signature &#39;s&#39;
<br>(string) it only supports unicode or UTF-8 str objects. If no signature is<br>declared but you use a str argument, dbus-python will guess that you<br>wanted signature &#39;s&#39; and the string has to be UTF-8.<br><br>
However, if your method is declared with signature &#39;ay&#39; (byte array) you<br>can pass arbitrary binary data. You probably want to put<br>byte_arrays=True in the @method decorator, so the method will get its<br>input as a 
dbus.ByteArray (a subclass of str) rather than as a<br>dbus.Array of dbus.Bytes (subclasses of: a list of ints).</blockquote><div><br>I hope this is a simple question: what is the preferred way to convert a file into a ByteArray for use with dBus?
<br></div></div><br>