New submission from Simon:
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.
----------
messages: 262101
nosy: SimonG, amaury.forgeotdarc, belopolsky, meador.inge, paul.moore,
steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Embbedable zip does not import modules in (zip)subdirectory
type: behavior
versions: Python 3.5
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue26598>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com