]> Dogcows Code - chaz/openbox/commitdiff
supply more information about errors when running scripts
authorDana Jansens <danakj@orodu.net>
Sun, 16 Feb 2003 18:16:55 +0000 (18:16 +0000)
committerDana Jansens <danakj@orodu.net>
Sun, 16 Feb 2003 18:16:55 +0000 (18:16 +0000)
src/python.cc
src/python.hh

index eb08775e08d7a5356288ee8e56f521a3c9cdda46..0741f2da940e4df8f40e4cb8ef91ab9e8ab84844 100644 (file)
@@ -35,12 +35,12 @@ void python_destroy()
   Py_Finalize();
 }
 
-bool python_exec(const std::string &path)
+int python_exec(const std::string &path)
 {
   FILE *rcpyfd = fopen(path.c_str(), "r");
   if (!rcpyfd) {
     fprintf(stderr, _("Unabled to open python file %s\n"), path.c_str());
-    return false;
+    return 1;
   }
 
   //PyRun_SimpleFile(rcpyfd, const_cast<char*>(path.c_str()));
@@ -51,7 +51,7 @@ bool python_exec(const std::string &path)
   assert(dict);
   PyObject *result = PyRun_File(rcpyfd, const_cast<char*>(path.c_str()),
                                 Py_file_input, dict, dict);
-  bool ret = result != NULL;
+  int ret = result == NULL ? 2 : 0;
   if (result == NULL)
     PyErr_Print();
   
index 8c3839041489132f40cbba8ce76997cd8779f4c0..f1d701a81c8804303b6d4d2b1a37916a1210858b 100644 (file)
@@ -231,7 +231,8 @@ typedef void (*EventCallback)(EventData*, void*);
 
 void python_init(char *argv0);
 void python_destroy();
-bool python_exec(const std::string &path);
+//! Returns 0 for success, 1 for failing to open the file, 2 for an exception
+int python_exec(const std::string &path);
 
 #endif // SWIG
 
This page took 0.02474 seconds and 4 git commands to generate.