[C++-sig] Re: compile errors with embedding example from tutorial
Chad Austin
caustin at gmail.com
Tue Jun 29 07:58:48 CEST 2004
On Mon, 28 Jun 2004 22:39:15 +0000 (UTC), Faheem Mitha
<faheem at email.unc.edu> wrote:
>
> On Mon, 28 Jun 2004 15:56:13 -0500, Chad Austin <caustin at gmail.com> wrote:
> > On Mon, 28 Jun 2004 17:48:59 +0000 (UTC), Faheem Mitha
> > <faheem at email.unc.edu> wrote:
> >>
> >> On Sun, 27 Jun 2004 23:46:06 -0500, Chad Austin <caustin at gmail.com> wrote:
>
> > Nope, sorry... I had a problem similar to that in that __builtins__
> > wasn't getting set in my modules, but I was doing some weird stuff.
> > You may want to at least check that __builtins__ is set in your
> > script.
>
> How should I do that? I thought that
>
> handle<> main_module(borrowed( PyImport_AddModule("__main__") ));
> handle<> main_namespace(borrowed( PyModule_GetDict(main_module.get())));
>
> should do the trick, though I don't really understand what these lines
> do. I wonder if the fact that I am calling the interpreter inside an
> extension module is causing any problems.
Just try evaluating the script "import __builtin__" or "str(10)" and
see if it fails or not. ;)
There should be no problem with calling interpreter from an extension
module. Language bindings are a two-way street, so there necessarily
must be communication between the two languages.
--
Chad Austin
http://aegisknight.org/
More information about the Cplusplus-sig
mailing list