[C++-sig] Trouble accessing custom object
David Abrahams
dave at boost-consulting.com
Fri May 13 19:21:11 CEST 2005
"Clarke, Ronald" <ron.clarke at hp.com> writes:
> // ...and try calling printProperties() again, to see if the new
> image is printed
> int nrunres = PyRun_SimpleString("imageIn.printProperties()\n");
>
>
> The address of pargsi looks reasonable, and the return code from the
> SetAttrString call is zero.
> However, PyRun_SimpleString fails with this error:
>
> Traceback (most recent call last):
> File "<string>", line 1, in ?
> NameError: name 'imageIn' is not defined
There's no reason for the unqualified name "imageIn" to be looked up
in your filter module AFAICT.
I suggest:
int nrunres = PyRun_SimpleString(
const_cast<char*>(
extract<char const*>(
str("from %s import *; imageIn.printProperties()\n") % sfilterName
)
)
);
HTH,
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list