> # CODE # > PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, NULL, NULL, 0, NULL, > NULL, NULL, NULL, NULL }; > > moduledef.m_name = "MyModule"; > moduledef.m_doc = "MyModule"; > pModule = PyModule_Create( &moduledef ); > PyState_AddModule( pModule, &moduledef ); > > PyRun_SimpleString( "print( globals() )\n" ); > PyRun_SimpleString( "import MyModule\nprint( globals() )\n" ); > # CODE # > > yields this: > > {'__name__': '__main__', '__builtins__': <module 'builtins' (built-in)>, > '__doc__': None, '__loader__': <class > '_frozen_importlib.BuiltinImporter'>, '__package__': None} > Traceback (most recent call last): > File "<string>", line 1, in <module> > ImportError: No module named 'MyModule' > Anybody got an idea? Somebody has a working example where he create a valid module from C++? It's just a namespace not even yet script sources applied.
-- Yours sincerely Plüss Roland Leader and Head Programmer - Game: Epsylon ( http://www.indiedb.com/games/epsylon ) - Game Engine: Drag[en]gine ( http://www.indiedb.com/engines/dragengine , http://dragengine.rptd.ch/wiki ) - Normal Map Generator: DENormGen ( http://epsylon.rptd.ch/denormgen.php ) - As well as various Blender export scripts und game tools
signature.asc
Description: OpenPGP digital signature
-- https://mail.python.org/mailman/listinfo/python-list