aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2008-06-21 15:31:57 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2008-06-21 15:31:57 +0000
commitda9872eac33f4f8a085261c3cbdcbf4c8d664f65 (patch)
tree45fbd868e6554cf4b2c478f06d08eca550ef4902 /lib/python
parent309ef1b36240139a265dd501c00d219ecd7428ca (diff)
downloadenigma2-da9872eac33f4f8a085261c3cbdcbf4c8d664f65.tar.gz
enigma2-da9872eac33f4f8a085261c3cbdcbf4c8d664f65.zip
use another function to initial import mytest.py (this fixes python
threads)... but take care of the fact that the most enigma2 code is not thread safe.. so dont call enigma2 parts from another python thread
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/python.cpp10
-rw-r--r--lib/python/python.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/python/python.cpp b/lib/python/python.cpp
index ad029fb6..b7a4cf38 100644
--- a/lib/python/python.cpp
+++ b/lib/python/python.cpp
@@ -133,6 +133,16 @@ ePython::~ePython()
Py_Finalize();
}
+int ePython::execFile(const char *file)
+{
+ FILE *fp = fopen(file, "r");
+ if (!fp)
+ return -ENOENT;
+ int ret = PyRun_SimpleFile(fp, file);
+ fclose(fp);
+ return ret;
+}
+
int ePython::execute(const std::string &pythonfile, const std::string &funcname)
{
ePyObject pName, pModule, pDict, pFunc, pArgs, pValue;
diff --git a/lib/python/python.h b/lib/python/python.h
index 9edc50ad..f56d49bb 100644
--- a/lib/python/python.h
+++ b/lib/python/python.h
@@ -370,6 +370,7 @@ class ePython
public:
ePython();
~ePython();
+ int execFile(const char *file);
int execute(const std::string &pythonfile, const std::string &funcname);
static int call(ePyObject pFunc, ePyObject args);
static ePyObject resolve(const std::string &pythonfile, const std::string &funcname);