鉴于有限的错误信息,我假设我的问题与您的问题相同。我得到的完整异常和回溯是:
>>> import pymouse
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pymouse/__init__.py", line 95, in <module>
from unix import PyMouse, PyMouseEvent
File "/usr/local/lib/python2.7/dist-packages/pymouse/unix.py", line 53, in <module>
class PyMouseEvent(PyMouseEventMeta):
File "/usr/local/lib/python2.7/dist-packages/pymouse/unix.py", line 66, in PyMouseEvent
'client_died': False,
File "/usr/local/lib/python2.7/dist-packages/Xlib/ext/record.py", line 121, in create_context
ranges = ranges)
File "/usr/local/lib/python2.7/dist-packages/Xlib/protocol/rq.py", line 1403, in __init__
self._binary = apply(self._request.to_binary, args, keys)
File "/usr/local/lib/python2.7/dist-packages/Xlib/protocol/rq.py", line 1088, in to_binary
return apply(self.to_binary, varargs, keys)
File "<string>", line 3, in to_binary
File "/usr/local/lib/python2.7/dist-packages/Xlib/protocol/rq.py", line 523, in pack_value
data.append(self.type.pack_value(v))
File "/usr/local/lib/python2.7/dist-packages/Xlib/protocol/rq.py", line 1102, in pack_value
return apply(self.to_binary, (), value)
File "/usr/local/lib/python2.7/dist-packages/Xlib/protocol/rq.py", line 1088, in to_binary
return apply(self.to_binary, varargs, keys)
File "<string>", line 4, in to_binary
File "/usr/local/lib/python2.7/dist-packages/Xlib/protocol/rq.py", line 573, in check_value
vals.append(f.check_value(val[i]))
File "/usr/local/lib/python2.7/dist-packages/Xlib/protocol/rq.py", line 582, in check_value
raise TypeError('Object value must be tuple, dictionary or DictWrapper: %s' % val)
TypeError: Object value must be tuple, dictionary or DictWrapper: 0
请注意异常发生在 Xlib 中。我安装了 0.15rc1 版本。降级到 0.14 解决了这个问题。