On Wed, May 21, 2014 at 3:17 AM, Roland Plüss <rol...@rptd.ch> wrote: > The important part are the last two lines. An important module is > lacking the __builtins__ dictionary member so I had to add it. > > Hopefully this works also in Py3 should I switch some time later. But I > guess it should seeing how simple the import now became.
An interesting omission, I'm a little surprised at that. But if your switch to Py3 is a serious (or even half-serious) possibility, I recommend tossing a quick comment against that line of code. Check to see if you actually need it, and if you still do, see if there's a change there. The module has been renamed (from __builtin__ to builtins, although the global reference to it is still __builtins__), so you may need to adjust something there, too. But mainly, see if you can drop that line of code in Py3. > Furthermore I had to call the string runner with moduleDict both as > global and local dictionary. With that change the virtual script is > properly loaded and working as it should. This part does make sense, though. Normally, module-level code runs with the same locals and globals: >>> locals() is globals() True And that doesn't change in Py3, so I would expect that your C++ code also won't change. ChrisA -- https://mail.python.org/mailman/listinfo/python-list