Ben Sizer wrote:
Yes, this seems to fix it, thanks. But why? Can some Python guru
explain why these two dictionaries must be the same? (Or what steps we
must take if we want them to be separate?)
What's happening is that the import statement is binding
the name 'sys' in the locals, not the glob
In article ,
Ben Sizer wrote:
>
>I have the following C++ code and am attempting to embed Python 2.5,
>but although the "import sys" statement works, attempting to reference
>"sys.path" from inside a function after that point fails. It's as if
>it's not treating it as a normal module but as any o
On Jan 14, 4:37 pm, Ivan Illarionov wrote:
> On Jan 14, 1:49 pm, Ben Sizer wrote:
>
> > No, I don't want to do anything with sys.path apart from see it. I
> > just wanted my original question answered, not a guess at my intent
> > and a solution for something I'm not doing. ;) Thanks though!
>
>
On Jan 14, 8:17 pm, Ivan Illarionov wrote:
> On Jan 14, 8:00 pm, Ben Sizer wrote:
>
> > 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 ou
On Jan 14, 8:00 pm, Ben Sizer wrote:
> 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 periodi
On Jan 14, 4:37 pm, Ivan Illarionov 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 a
On Jan 14, 1:49 pm, Ben Sizer wrote:
> No, I don't want to do anything with sys.path apart from see it. I
> just wanted my original question answered, not a guess at my intent
> and a solution for something I'm not doing. ;) Thanks though!
>
> Again - why can I not reference sys from within the f
On Jan 14, 1:55 am, Ivan Illarionov wrote:
> Ben Sizer wrote:
> > What am I doing wrong?
>
> What are you trying to achieve?
> If you want to modify sys.path I suggest using Python/C API directly:
No, I don't want to do anything with sys.path apart from see it. I
just wanted my original question
Ivan Illarionov schrieb:
> Ben Sizer wrote:
>> What am I doing wrong?
>
> What are you trying to achieve?
> If you want to modify sys.path I suggest using Python/C API directly:
> (boilerplate removed)
> PyImport_ImportModule("sys")
> PyObject_GetAttrString(sysmod_pointer, "path")
> PyList_Insert
Ben Sizer wrote:
> What am I doing wrong?
What are you trying to achieve?
If you want to modify sys.path I suggest using Python/C API directly:
(boilerplate removed)
PyImport_ImportModule("sys")
PyObject_GetAttrString(sysmod_pointer, "path")
PyList_Insert(pathobj_pointer, 0, path_python_str)
--
I have the following C++ code and am attempting to embed Python 2.5,
but although the "import sys" statement works, attempting to reference
"sys.path" from inside a function after that point fails. It's as if
it's not treating it as a normal module but as any other global
variable which I'd have to
11 matches
Mail list logo