4

I'm using ldtp and while I import it ,my idle jump out with a error:

from ldtp import *
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/ldtpd/__init__.py", line 38, in <module>
from xmlrpc_daemon import XMLRPCLdtpd
File "/usr/local/lib/python2.7/site-packages/ldtpd/xmlrpc_daemon.py",line 25, in <module>
import core
File "/usr/local/lib/python2.7/site-packages/ldtpd/core.py", line 24, in <module>
from pyatspi import findDescendant, Registry
ImportError: No module named pyatspi

And then I yum install pyatspi but found

No package pyatspi available.

Then I download pyatspi-2.20.0.tar.xz

During ./configure ,an error occurs as

configure: error: Package requirements (pygobject-3.0 >= 2.90.1) were not met:
No package 'pygobject-3.0' found

So I go back and try to install pygobject and found:

configure: error: Package requirements (glib-2.0 >= 2.24.0
gobject-introspection-1.0 >= 1.29.0
) were not met:
No package 'gobject-introspection-1.0' found

Excuse me ???

Is that the same thing we all have to suffer during install pyatspi???

What should I do to jump out from this nightmare?

Thanks for any help !

Dima Chubarov
  • 16,199
  • 6
  • 40
  • 76
Ziyuan Ma
  • 103
  • 1
  • 2
  • 10
  • You should use a package manager such as `pip` or `conda`. See also [this post](http://stackoverflow.com/a/13445719/1328439) – Dima Chubarov Nov 25 '16 at 07:45
  • @DmitriChubarov Thanks for you kindly reply . I tried with your suggestion but it make no effect : Could not find a version that satisfies the requirement pyatspi (from versions: ) No matching distribution found for pyatspi – Ziyuan Ma Nov 25 '16 at 07:57

1 Answers1

4

pyatspi is a part of GNOME. What you got involved into by building pyatspi from source was leading you into building a significant part of GNOME from source. No easy task at all.

Your best bet is to find AT SPI package for your distribution. You did not specify what linux distribution do you have. But for most common distributions such packages exist.

First make sure you have got python-gobject installed

For rpm-based distributions

 rpm -q python-gobject

For dpkg-based:

 dpkg -s python-gobject

Install it if necessary.

Next install a package containing pyatspi for your distribution. For instance for OpenSUSE you need to install python-atspi

zypper in python-atspi

For Ubuntu and derivatives it is python-pyatspi:

apt-get install python-pyatspi

For RedHat, Fedora and derivatives it is at-spi-python

yum install at-spi-python

Having got that you should be able to type

python -c "import gi,pyatspi"
OlivierM
  • 2,820
  • 24
  • 41
Dima Chubarov
  • 16,199
  • 6
  • 40
  • 76
  • 2
    Thanks ! But how can I obtain python-gobject package? I'm using RHEL6.8 and after I input "rpm -q python-gobject" my terminal response as "package python-gobject is not installed" . Yum nor pip could find a python-gobject package. – Ziyuan Ma Nov 28 '16 at 01:08
  • BY the way , the terminal told me :"Package pygobject2-2.20.0-5.el6.x86_64 already installed and latest version" Maybe it is same with python-object? – Ziyuan Ma Nov 28 '16 at 01:11
  • Sorry for bother you but I also found "Package at-spi-python-1.28.1-2.el6.x86_64 already installed and latest version" So why my ldtp told me no module named pyatspi ? – Ziyuan Ma Nov 28 '16 at 01:13
  • None of this works for virtual environments, which is how most Python apps are run. – Cerin Mar 19 '21 at 17:55
  • @Cerin well, since pyatspi is a python wrapper around Gnome AT-SPI library, you would need to get gnome libs in your venv. By the way this post is almost 5 years old and things might have changed since. – Dima Chubarov Mar 20 '21 at 16:38