X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/6f73e6abddf4170357c490966d0e1c622eb376f5..19ce1123c780a9475e2f158712da6e73fa543e9c:/lib/python/python.cpp diff --git a/lib/python/python.cpp b/lib/python/python.cpp index ad029fb6..50b66103 100644 --- a/lib/python/python.cpp +++ b/lib/python/python.cpp @@ -4,6 +4,7 @@ #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 @@ -126,6 +127,7 @@ ePython::ePython() init_enigma(); eBaseInit(); + eConsoleInit(); } ePython::~ePython() @@ -133,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;