X-Git-Url: http://code.vuplus.com/gitweb/?a=blobdiff_plain;f=lib%2Fpython%2Fpython.cpp;h=b7a4cf38251320313631fd6498abc9b176198b3f;hb=32f2aee04a0b7dbdbe561b232f90ead5edf83a7e;hp=84716e7226626f5b9ce119b4411d3b1c2d595793;hpb=8d4c6e68e456e6e0a4db27091a7f384854949162;p=vuplus_dvbapp diff --git a/lib/python/python.cpp b/lib/python/python.cpp index 84716e7..b7a4cf3 100644 --- a/lib/python/python.cpp +++ b/lib/python/python.cpp @@ -3,6 +3,7 @@ #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200112L extern "C" void init_enigma(); +extern "C" void eBaseInit(void); extern void bsodFatal(); #define SKIP_PART2 @@ -124,6 +125,7 @@ ePython::ePython() PyEval_InitThreads(); init_enigma(); + eBaseInit(); } ePython::~ePython() @@ -131,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;