Boost logo

Boost Users :

Subject: Re: [Boost-users] [python] Defining a variable
From: Robert Dailey (rcdailey_at_[hidden])
Date: 2008-09-25 19:31:14


On Thu, Sep 25, 2008 at 6:31 AM, Neal Becker <ndbecker2_at_[hidden]> wrote:

> Robert Dailey wrote:
>
> > On Wed, Sep 24, 2008 at 7:08 PM, Neal Becker <ndbecker2_at_[hidden]>
> wrote:
> >
> >> Robert Dailey wrote:
> >>
> >> <snip>
> >>
> >> How about:
> >> scope().attr("something") = whatever;
> >
> >
> > Where would this code go? What does scope() do?
>
> You could put it here:
> BOOST_PYTHON_MODULE ... {
>
> scope().attr ("something") = 42;

I can't do it where I define the module because I'm passing a pointer to an
object to python. This needs to be available as the script is executed, and
this pointer value is only known to a certain class (It isn't globally
accessible, so it couldn't possibly be set where the python module is
defined).

I know it needs to be done the way I originally posted, but I need to know
why it is throwing an exception.

Thanks for the help.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net