Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71840
| From | Stefan Behnel <stefan_ml@behnel.de> |
|---|---|
| Subject | Re: Loading modules from files through C++ |
| Date | 2014-05-21 08:33 +0200 |
| References | (8 earlier) <53778E22.3040701@rptd.ch> <ll84s5$5bd$1@ger.gmane.org> <53790CCF.1070905@rptd.ch> <CAPTjJmrOeSsmoxqk8iCL2tKEX9Qa1yHBLzfbfvNr_7Ap+AP6pg@mail.gmail.com> <537B8E31.7000607@rptd.ch> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.10179.1400654047.18130.python-list@python.org> (permalink) |
Roland Plüss, 20.05.2014 19:17: > PyObject * const loadedModule = Py_InitModule3( fullname, NULL, "Loaded > module" ); > PyObject * const moduleDict = PyModule_GetDict( loadedModule ); // > borrowed reference > PyDict_SetItemString( moduleDict, "__builtins__", PyEval_GetBuiltins() ); > PyRun_StringFlags( fileContent, Py_file_input, moduleDict, moduleDict, > NULL ); > > Hopefully this works also in Py3 should I switch some time later. But I > guess it should seeing how simple the import now became. The general principle should still work, just the module creation has changed. Stefan
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Loading modules from files through C++ Stefan Behnel <stefan_ml@behnel.de> - 2014-05-21 08:33 +0200
csiph-web