擅长:python、mysql、java
<p>如果没有显式指定签名,您使用的D-Bus绑定(dbus-python)将假定字典中的所有类型都与字典中的任意项相同。在本例中,dbuspython假设字典中的所有条目都是“ss”。在</p>
<p>从<a href="http://dbus.freedesktop.org/doc/dbus-python/doc/tutorial.html#container-types" rel="nofollow">dbus-python tutorial</a>:</p>
<blockquote>
<p>Dictionaries are represented by Python dictionaries, or by dbus.Dictionary, a subclass of dict. When sending a dictionary, if an introspected signature is available, that will be used; otherwise, if the signature keyword parameter was passed to the Dictionary constructor, that will be used to determine the contents' key and value signatures; otherwise, dbus-python will guess from an arbitrary item of the dict.</p>
</blockquote>
<p>所以你需要指出字典中的类型。显式指定签名的一种方法是创建如下数据:</p>
<pre><code>inner = dbus.Dictionary({'a': 'a', 'b': 1}, signature='sv')
outer = dbus.Dictionary({'a': 'b', 'b': 1, 'c': inner}, signature='sv')
s.TickSignal(outer)
</code></pre>
<p>希望这有帮助。在</p>