13

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.

2
  • You should probably move this to the Raspberry Pi Stack Exchange, since you are using Raspian. Dec 31, 2015 at 22:09
  • Did you check for differing versions between your Debian and Raspbian installations? One of Xorg / pymouse / any of their dependencies might be materially different. Feb 3, 2016 at 17:44

2 Answers 2

1

You can test this without the rest of pymouse by firing up python and running

from Xlib.display import Display
display = Display()
display.record_create_context

which should print

<bound method Display.create_context of <Xlib.display.Display instance at ...>>

Looks like that corresponds to

$ xdpyinfo | grep -i record
    RECORD

(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 got record support in version 0.14 in 2007, so that's even less likely to be out of date...

0

http://mirrordirector-mb.raspbian.org/raspbian/pool/main/x/xmacro/

This is a macro recorder. It's compiled but I assume it works as it says. I haven't tested it, but it seems a lot easier than hacking round with a python program that you can't figure out where it's breaking.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .