summaryrefslogtreecommitdiff
path: root/pyuno
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2011-08-20 17:00:29 +0200
committerLionel Elie Mamane <lionel@mamane.lu>2011-08-21 01:46:07 +0200
commit41a68a4f77a639def35d778b86b6aeda8fe60a7b (patch)
tree4354ff5bd1fee6d5c659519a57f4f97d5fe7c5d0 /pyuno
parenta9b9b40570e6cf26ac23cd49b043d8bc2e878240 (diff)
pyuno: hook into import *after* the _whole_ uno module is successfully loaded
This avoids breaking the whole python process module importing when an uno.py import failure happens after the hooking point. In that case, _uno_import is still the python module loader, but _g_delegatee is not anymore bound to the previously installed importer, and thus any module import fails with: File "/home/master/src/libreoffice/core/install/basis3.5/program/uno.py", line 260, in _uno_import return _g_delegatee( name, *optargs, **kwargs ) TypeError: 'NoneType' object is not callable
Diffstat (limited to 'pyuno')
-rw-r--r--pyuno/source/module/uno.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/pyuno/source/module/uno.py b/pyuno/source/module/uno.py
index 99fd0f04ab3a..e82d9d64e2dc 100644
--- a/pyuno/source/module/uno.py
+++ b/pyuno/source/module/uno.py
@@ -301,9 +301,6 @@ def _uno_import( name, *optargs, **kwargs ):
raise ImportError( "type "+ name + "." +x + " is unknown" )
return mod
-# hook into the __import__ chain
-__builtin__.__dict__["__import__"] = _uno_import
-
# private function, don't use
def _impl_extractName(name):
r = list(range(len(name)-1,0,-1))
@@ -366,4 +363,7 @@ def _uno_extract_printable_stacktrace( trace ):
ret = "Couldn't import traceback module"
return ret
+# hook into the __import__ chain
+__builtin__.__dict__["__import__"] = _uno_import
+
# vim:set shiftwidth=4 softtabstop=4 expandtab: