[glom/glom-1-16] 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-16] libglom_init(): Show the python exception when PyDateTime_IMPORT fails.
- Date: Mon, 14 Mar 2011 05:50:43 +0000 (UTC)
commit 69fa8763d532756cc5b3dedcfcda7e3c2e089cf2
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 042586e..48707a3 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-02-26 Murray Cumming <murrayc murrayc com>
Fix the CSV import test.
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]