[glom/glom-1-18] libglom_init(): Show the python exception when PyDateTime_IMPORT fails.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/glom-1-18] libglom_init(): Show the python exception when PyDateTime_IMPORT fails.
- Date: Mon, 14 Mar 2011 05:49:02 +0000 (UTC)
commit 535fc66143d9a179bcb176272b577b595690969a
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Mar 14 06:46:39 2011 +0100
libglom_init(): Show the python exception when PyDateTime_IMPORT fails.
* glom/libglom/init.cc: The linker seems to behave differently when this
code is run from inside a JVM in OnlineGlom. This gives us a clue.
ChangeLog | 7 +++++++
glom/libglom/init.cc | 9 +++++++++
2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d0a696d..ffe699e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-03-14 Murray Cumming <murrayc murrayc com>
+
+ libglom_init(): Show the python exception when PyDateTime_IMPORT fails.
+
+ * glom/libglom/init.cc: The linker seems to behave differently when this
+ code is run from inside a JVM in OnlineGlom. This gives us a clue.
+
2011-03-08 Murray Cumming <murrayc murrayc com>
Remove some unnecessary padding/borders around the main window.
diff --git a/glom/libglom/init.cc b/glom/libglom/init.cc
index 97a813e..f9e8e6c 100644
--- a/glom/libglom/init.cc
+++ b/glom/libglom/init.cc
@@ -48,6 +48,15 @@ void libglom_init()
Py_Initialize();
PyDateTime_IMPORT; //A macro, needed to use PyDate_Check(), PyDateTime_Check(), etc.
+ if(!PyDateTimeAPI)
+ {
+ //Give people a clue on stdout:
+ std::cerr << G_STRFUNC << ": PyDateTime_IMPORT (a python module import) failed." << std::endl;
+
+ //This gives more information. When this happens it is generally a linker
+ //failure while importing a python module:
+ PyErr_Print();
+ }
g_assert(PyDateTimeAPI); //This should have been set by the PyDateTime_IMPORT macro.
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]