I'm trying to automate some tests on my RaspberryPi and I'm using python's pymouse to perform some emulated clicks. On my Debian it works fine, but when it comes to Raspbian it keeps failing with this error message when trying to import pymouse:
pi@pi ~/ $ python test.py
Traceback (most recent call last):
File "test.py", line 2, in <module>
from pymouse import PyMouse
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 54, in PyMouseEvent
ctx = display2.record_create_context(
File "/usr/lib/pymodules/python2.7/Xlib/display.py", line 216, in __getattr__
raise AttributeError(attr)
AttributeError: record_create_context
So I did some research and found, that my issue might be caused by the missing record module in my x11 installation. I already created a default /etc/X11/xorg.conf and added the following lines:
Section "Module"
Load "record"
EndSection
After a restart I could not find any difference. I guess, the module is not installed so far in Raspbian? How can I install it?
Update:
I found someone else, who encountered a similar problem on fedora and he documented the fact, that his /usr/lib/xorg/modules/extensions/librecord.so
was missing. This does not seem to be my problem, as the file is existant.
I also tried to use Xorg -configure
to create a new xorg.conf and restarted my Pi afterwards. Still no luck. 🙁
Here are some more information that might be helpful:
pi@pi ~/ $ grep LoadModule /var/log/Xorg.0.log
[169058.900] (II) LoadModule: "fbturbo"
[169058.912] (II) LoadModule: "fbdev"
And:
pi@pi ~/ $ xdpyinfo name of display: :0.0 version number: 11.0 vendor string: AT&T Laboratories Cambridge vendor release number: 3332 [...] number of extensions: 7
BIG-REQUESTS
MIT-SHM
MIT-SUNDRY-NONSTANDARD
SHAPE
SYNC
XC-MISC
XTEST [...]
This post was migrated from RaspberryPi.stackexchange.com.
Best Answer
You can test this without the rest of pymouse by firing up python and running
which should print
Looks like that corresponds to
(that's under
number of extensions:
in the full output.)If the latter doesn't show up, your X server doesn't support it, which is very unusual since it became part of the core server in July 2012 - which also explains why trying to load the module isn't working; there hasn't been a module to load since about four years ago.
python-xlib
itself gotrecord
support in version 0.14 in 2007, so that's even less likely to be out of date...