Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'scripts': 0.03; 'programmer': 0.03; 'importerror:': 0.07; 'none,': 0.07; 'idea?': 0.09; 'namespace': 0.09; 'null,': 0.09; 'subject:files': 0.09; 'subject:modules': 0.09; 'filename:fname piece:signature': 0.16; 'received:192.168.1.20': 0.16; 'url:ch': 0.16; 'module': 0.19; "skip:' 30": 0.19; 'example': 0.22; 'header:User-Agent:1': 0.23; 'script': 0.25; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'code': 0.31; "skip:' 10": 0.31; 'url:wiki': 0.31; '"",': 0.31; 'yields': 0.31; 'file': 0.32; '(most': 0.33; 'sources': 0.33; 'subject:from': 0.34; 'anybody': 0.35; 'somebody': 0.38; 'to:addr :python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'und': 0.40; 'even': 0.60; 'sincerely': 0.63; 'map': 0.64; 'export': 0.74; 'url:php': 0.85; 'yours': 0.88 Date: Sat, 24 May 2014 16:48:23 +0200 From: =?ISO-8859-1?Q?Roland_Pl=FCss?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Loading modules from files through C++ References: <5376ACE7.8030706@rptd.ch> <53775D68.2010009@rptd.ch> <537768FB.7060303@rptd.ch> <53778005.8030105@rptd.ch> <53778E22.3040701@rptd.ch> <53790CCF.1070905@rptd.ch> <537B8E31.7000607@rptd.ch> <537D2433.7080606@rptd.ch> In-Reply-To: <537D2433.7080606@rptd.ch> X-Enigmail-Version: 1.6 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Gu7k0pH8jtEG3g7NpUvWgK5ajC4Hh5g6t" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 61 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1400942910 news.xs4all.nl 2846 [2001:888:2000:d::a6]:34326 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71964 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Gu7k0pH8jtEG3g7NpUvWgK5ajC4Hh5g6t Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable > # CODE # > PyModuleDef moduledef =3D { PyModuleDef_HEAD_INIT, NULL, NULL, 0, NULL,= > NULL, NULL, NULL, NULL }; > > moduledef.m_name =3D "MyModule"; > moduledef.m_doc =3D "MyModule"; > pModule =3D 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__': = , > '__doc__': None, '__loader__': '_frozen_importlib.BuiltinImporter'>, '__package__': None} > Traceback (most recent call last): > File "", line 1, in > 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. --=20 Yours sincerely Pl=FCss 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 --Gu7k0pH8jtEG3g7NpUvWgK5ajC4Hh5g6t Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlOAsUAACgkQjKGu9ysRWfqd8gCfcaRVpKmlLDeRG4ioESgO3NE8 pH4AnjBTG3c9mQG2Ng5Y6TYGYirao0jK =NsMq -----END PGP SIGNATURE----- --Gu7k0pH8jtEG3g7NpUvWgK5ajC4Hh5g6t--