This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author SimonG
Recipients SimonG, amaury.forgeotdarc, belopolsky, meador.inge, paul.moore, steve.dower, tim.golden, zach.ware
Date 2016-03-21.05:05:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1458536716.69.0.0292011453311.issue26598@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-03-21 05:05:16SimonGsetrecipients: + SimonG, paul.moore, amaury.forgeotdarc, belopolsky, tim.golden, meador.inge, zach.ware, steve.dower
2016-03-21 05:05:16SimonGsetmessageid: <1458536716.69.0.0292011453311.issue26598@psf.upfronthosting.co.za>
2016-03-21 05:05:16SimonGlinkissue26598 messages
2016-03-21 05:05:14SimonGcreate