'Import sys' succeeds in C++ embedded code, but module is not fully visible

Ben Sizer kylotan at gmail.com
Wed Jan 14 18:00:01 CET 2009


On Jan 14, 4:37 pm, Ivan Illarionov <ivan.illario... at gmail.com> wrote:
>
> I would try to use ourNamespace_ dict for
> both globals and locals in PyRun_String call.

I will try it when I get home. However I would like to be able to
treat them as separate dictionaries, as I want to be able to import
some symbols and modules at a global level, but be able to clear out
objects introduced at the local level on a periodic basis, so that I
can have some degree of isolation between distinct 'scripts'. The docs
aren't terribly clear about what the globals and locals parameters to
PyRun_String actually do, though.

I also wonder if this is something specific to the sys module, since
it's already been shown that there are some specific C API functions
for it. I will try with other modules and see if they exhibit the same
symptoms.

And I'm still wondering about the sys.path[0] question. :)


--
Ben Sizer



More information about the Python-list mailing list