X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/8d4c6e68e456e6e0a4db27091a7f384854949162..2b1a35585e9edead2200e4e4868d549c3b1e8106:/lib/python/python.cpp diff --git a/lib/python/python.cpp b/lib/python/python.cpp index 84716e72..50b66103 100644 --- a/lib/python/python.cpp +++ b/lib/python/python.cpp @@ -3,6 +3,8 @@ #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200112L extern "C" void init_enigma(); +extern "C" void eBaseInit(void); +extern "C" void eConsoleInit(void); extern void bsodFatal(); #define SKIP_PART2 @@ -124,6 +126,8 @@ ePython::ePython() PyEval_InitThreads(); init_enigma(); + eBaseInit(); + eConsoleInit(); } ePython::~ePython() @@ -131,6 +135,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;