[glom] Mention the failed python module name on stdcerr.



commit 7a00472e4c9392de5426607718f3e2825bf1e59b
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Sep 4 15:34:26 2009 +0200

    Mention the failed python module name on stdcerr.
    
    * glom/python_embed/glom_python.cc: glom_python_module_is_available(),
    gda_python_module_is_available(): Output a hint to the command-line too,
    in case maemo crashes when showing UI as mine does at the moment,
    and to mention the exact python module name that failed.

 ChangeLog                        |    9 +++++++++
 glom/python_embed/glom_python.cc |   18 ++++++++++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e3c6e5c..638c5dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,15 @@
 
 2009-09-04  Murray Cumming  <murrayc murrayc com>
 
+	Mention the failed python module name on stdcerr.
+
+	* glom/python_embed/glom_python.cc: glom_python_module_is_available(), 
+	gda_python_module_is_available(): Output a hint to the command-line too, 
+	in case maemo crashes when showing UI as mine does at the moment, 	
+	and to mention the exact python module name that failed.
+
+2009-09-04  Murray Cumming  <murrayc murrayc com>
+
 	Fix the client-only non-maemo build on maemo.
 
 	* configure.ac: Correct the AS_IF() calls so that we really do not 
diff --git a/glom/python_embed/glom_python.cc b/glom/python_embed/glom_python.cc
index da65de9..e0f8dc5 100644
--- a/glom/python_embed/glom_python.cc
+++ b/glom/python_embed/glom_python.cc
@@ -139,13 +139,27 @@ void ShowTrace()
 
 bool glom_python_module_is_available()
 {
-  PyObject* module_glom = PyImport_ImportModule((char*)"glom_" GLOM_ABI_VERSION_UNDERLINED); //TODO: unref this?
+  const gchar* name = "glom_" GLOM_ABI_VERSION_UNDERLINED;
+  PyObject* module_glom = PyImport_ImportModule((char*)name); //TODO: unref this?
+
+  if(!module_glom)
+  {
+    g_warning("Glom: A python import of %s failed.\n", name);
+  }
+
   return module_glom != 0;
 }
 
 bool gda_python_module_is_available()
 {
-  PyObject* module_glom = PyImport_ImportModule((char*)"gda"); //TODO: unref this?
+  const gchar* name = "gda";
+  PyObject* module_glom = PyImport_ImportModule((char*)name); //TODO: unref this?
+
+  if(!module_glom)
+  {
+    g_warning("Glom: A python import of %s failed.\n", name);
+  }
+
   return module_glom != 0;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]