[New-bugs-announce] [issue26598] Embbedable zip does not import modules in (zip)subdirectory
Simon
report at bugs.python.org
Mon Mar 21 01:05:16 EDT 2016
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 <report at bugs.python.org>
<http://bugs.python.org/issue26598>
_______________________________________
More information about the New-bugs-announce
mailing list