diff options
author | Michael Meeks <michael.meeks@suse.com> | 2011-12-05 19:44:49 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2011-12-05 20:53:24 +0000 |
commit | 1a7eee2446dfbe06ac39941473010fc8915ee6e6 (patch) | |
tree | bc5d1249caa05432540b86267fd24e800ea4b2fe | |
parent | 41b8bad143c06bc5419783b9f3cf5685aa3eea63 (diff) |
Improve pyuno debugging in various ways - add stack traces etc.
-rw-r--r-- | pyuno/source/loader/pythonloader.py | 6 | ||||
-rw-r--r-- | pyuno/source/module/pyuno_runtime.cxx | 4 | ||||
-rw-r--r-- | pyuno/source/module/uno.py | 6 |
3 files changed, 11 insertions, 5 deletions
diff --git a/pyuno/source/loader/pythonloader.py b/pyuno/source/loader/pythonloader.py index 5675a0c9596c..c4fa69d7ef28 100644 --- a/pyuno/source/loader/pythonloader.py +++ b/pyuno/source/loader/pythonloader.py @@ -111,7 +111,8 @@ class Loader( XImplementationLoader, XServiceInfo, unohelper.Base ): g_loadedComponents[url] = mod return mod elif "vnd.openoffice.pymodule" == protocol: - print ("here") + # the failure is on symbol lookup later in the parent ... + print ("Warning: Python module loading is almost certainly pre-broken") nSlash = dependent.rfind('/') if -1 != nSlash: path = unohelper.fileUrlToSystemPath( dependent[0:nSlash] ) @@ -127,7 +128,8 @@ class Loader( XImplementationLoader, XServiceInfo, unohelper.Base ): protocol + " in url " +url, self ) except Exception as e: if DEBUG: - print ("Python import error " + str(e) + " args " + str(e.args)); + print ("Python import exception " + str(type(e)) + + " message " + str(e) + " args " + str(e.args)); raise RuntimeException( "Couldn't load " + url + " for reason " + str(e), None ) return None diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx index c09cc5c17b0f..e15a72dd054a 100644 --- a/pyuno/source/module/pyuno_runtime.cxx +++ b/pyuno/source/module/pyuno_runtime.cxx @@ -1008,6 +1008,10 @@ Any Runtime::extractUnoException( const PyRef & excType, const PyRef &excValue, } RuntimeException e; e.Message = buf.makeStringAndClear(); +#if OSL_DEBUG_LEVEL > 0 + fprintf( stderr, "Python exception: %s\n", + rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr() ); +#endif ret = com::sun::star::uno::makeAny( e ); } return ret; diff --git a/pyuno/source/module/uno.py b/pyuno/source/module/uno.py index e82d9d64e2dc..f93ac5e13fcc 100644 --- a/pyuno/source/module/uno.py +++ b/pyuno/source/module/uno.py @@ -333,7 +333,7 @@ def _uno_struct__setattr__(self,name,value): # private, referenced from the pyuno shared library def _uno_struct__repr__(self): return repr(self.__dict__["value"]) - + def _uno_struct__str__(self): return str(self.__dict__["value"]) @@ -363,7 +363,7 @@ def _uno_extract_printable_stacktrace( trace ): ret = "Couldn't import traceback module" return ret -# hook into the __import__ chain +# hook into the __import__ chain __builtin__.__dict__["__import__"] = _uno_import - + # vim:set shiftwidth=4 softtabstop=4 expandtab: |