Message262101
I downloaded the Embeddable zip file from the Python site, (https://www.python.org/downloads/release/python-351/) and rand the code below.
When I run the code below certain modules are not imported while others are imported fine.
The modules that are not imported seem to be the ones sub-directories within the zip file.
(omitted obvious code, error checking and some cleanup)
...
int main()
{
// ...
Py_SetProgramName(L"AAAAA");
Py_SetPath(L"path\\to\\python35.zip"); // embeddable from the python site.
Py_Initialize();
PyThreadState *mainstate = PyThreadState_Get();
PyInterpreterState* mainInterpreterState = mainstate->interp;
PyObject *main_module = PyImport_AddModule("__main__");
PyObject *main_dict = PyModule_GetDict(main_module);
PyObject *local_dic = PyDict_New();
const char* s = "import ctypes\n";
PyObject * PyRes = PyRun_String(s, Py_file_input, main_dict, local_dic);
PyObject* ex = PyErr_Occurred();
if (NULL != ex)
{
// didn't work, import error.
}
}
The exact same code above manages to import other modules as long as they are located inside the root of the zip file.
modules like json/ctypes and so on are not imported as they are in a sub directory. |
|
Date |
User |
Action |
Args |
2016-03-21 05:05:16 | SimonG | set | recipients:
+ SimonG, paul.moore, amaury.forgeotdarc, belopolsky, tim.golden, meador.inge, zach.ware, steve.dower |
2016-03-21 05:05:16 | SimonG | set | messageid: <1458536716.69.0.0292011453311.issue26598@psf.upfronthosting.co.za> |
2016-03-21 05:05:16 | SimonG | link | issue26598 messages |
2016-03-21 05:05:14 | SimonG | create | |
|