how to set PYTHONPATH to allow overrides in extra directories?



gedit installs a file Gedit.py whch contains overrides for GObject introspection.  I've built and installed gedit locally (in /home/adam/local), and I have Gedit.py at

  /home/adam/local/lib64/python3/dist-packages/gi/overrrides/Gedit.py

I'm trying to get Python to recognize this overrides file.  According to this bug which was closed last August, it should be possible:

  https://bugzilla.gnome.org/show_bug.cgi?id=680913

Following the instructions at https://bugzilla.gnome.org/show_bug.cgi?id=680913#c24, I've done the following:

- My PYTHONPATH is /home/adam/local/lib64/python3/dist-packages .
- I've created these files:

  /home/adam/local/lib64/python3/dist-packages/gi/__init__.py
  /home/adam/local/lib64/python3/dist-packages/gi/overrrides/__init__.py

Both of these files contain this text exactly:

  from pkgutil import extend_path
  __path__ = extend_path(__path__, __name__)

But now when I run gedit and try to enable a plugin which uses Python I see this:

Traceback (most recent call last):
  File "/home/adam/local/lib64/gedit/plugins/quickopen/__init__.py", line 20, in <module>
    from .popup import Popup
  File "/home/adam/local/lib64/gedit/plugins/quickopen/popup.py", line 23, in <module>
    from gi.repository import Gio, GObject, Pango, Gtk, Gdk, Gedit
  File "/usr/lib/python3/dist-packages/gi/repository/__init__.py", line 25, in <module>
    from ..importer import DynamicImporter
  File "/usr/lib/python3/dist-packages/gi/importer.py", line 28, in <module>
    from .module import DynamicModule
  File "/usr/lib/python3/dist-packages/gi/module.py", line 37, in <module>
    from .overrides import registry
  File "/usr/lib/python3/dist-packages/gi/overrides/__init__.py", line 5, in <module>
    from gi import PyGIDeprecationWarning
ImportError: cannot import name PyGIDeprecationWarning

This error does not occur when PYTHONPATH is not set.

What am I doing wrong?  Any clue?

adam


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]