From the Python documentation:
The __init__.py files are necessary for Python to treat directories as containing packages ; this is done to prevent directories with a common name, such as a string, inadvertently hiding the active modules that appear later in the module search path.
Just having these __init__.py files available from a working directory, you tell the interpreter that this is an implementation of the gi module. Any use of the main gi module will not be correct.
Now, why is it printing an error coming from /usr/lib ? Because gi was found in local/gi , but gi.repository was found in /usr/lib/python2.7/dist-packages/gi/repository . It works /usr/lib/python2.7/dist-packages/gi/repository/__init__.py . From there, it imports some other submodules correctly, but when it tries to import overrides , it finds your local stub in gi/overrides . Your stub does not detect the registry, so you have a failure.
Try adding registry='dumb_string' to gi/overrides/__init__.py and see that the error gi/overrides/__init__.py away.
source share