PyGObject (3.4.0) - importing overrides modules from different directories
- From: Lukas Vacek <lucas vacek gmail com>
- To: python-hackers-list gnome org
- Subject: PyGObject (3.4.0) - importing overrides modules from different directories
- Date: Mon, 22 Oct 2012 13:35:56 +0100
Hi All,
I have found out it's not possible to load installed GI overrides from
a different directory than where PyGObject itself is installed
(/usr/lib/python2.7/dist-packages/ in my case).
Ideally gi overrides modules could be installed to user site-packages
directory and still would be loaded by system installation of
PyGObject.
The problem is that the overrides module can't install __init__.py
file because it would conflict with __init__.py already installed by
system PyGObject. (Or even if the file was not installed in the same
location but the installed overrides module (with own __init__.py)
would appear before system PyGObject in sys.path it would be loaded
instead of PyGObject as gi module and break things. )
However, __init__.py must be present in the gi overrides module
directory in order to be recognized by __import__ call made by
PyGObject when loading overrides module (module.py around line 244).
This makes it complicated to use gi overrides module from a different
directory. The workaround is to load _uninstalled_ gi overrides
modules with PYTHONPATH which explicitly mentions PyGObject path
before the path to overrides modules. For example, this is how I run
pitivi: PYTHONPATH=/usr/lib/python2.7/dist-packages/:~/dev/gst-python/
python bin/pitivi
Pitivi bugs https://bugzilla.gnome.org/show_bug.cgi?id=686341 and
https://bugzilla.gnome.org/show_bug.cgi?id=686342 seem to be related
to/caused by this.
To solve this pygobject might look for a ".py" file instead of a module.
Thanks!
Lukas Vacek
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]