when i: "fun(**kwargs)"
I get following runtime error:
TypeError: No to_python (by-value) converter found for C++ type:
boost::python::detail::kwds_proxy

thx again

meiko



> Message: 1
> Date: Thu, 3 Dec 2009 13:11:41 +0100
> From: meiko rachimow <[email protected]>
> To: [email protected]
> Subject: [C++-sig] boost.python: call python function with kwargs from
>        c++
> Message-ID:
>        <[email protected]>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi
>
> How can I call a function defined in a python module from c++,
> if I have to give **kwargs parameter...
>
> example.py:
>
> def hello(**kwargs):
>    for key, value in kwargs.items():
>        print key, " - ",  value
>
>
> c++:
> using namespace boost::python;
>
> object fun = import("example").attr("hello")
> fun()
>
> int number = 42
> std::wstring name = "M?hre"
>
> dict kwargs;
> kwargs["Number"] = number;
> kwargs["Name"] = name;
>
> fun(...) ???
>
> What should i do ?
>
> Meiko
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.python.org/pipermail/cplusplus-sig/attachments/20091203/f7b0db6e/attachment-0001.htm
> >
>
> ------------------------------
>
> Message: 2
> Date: Thu, 03 Dec 2009 08:11:36 -0500
> From: Stefan Seefeld <[email protected]>
> To: [email protected]
> Subject: Re: [C++-sig] boost.python: call python function with kwargs
>        from c++
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> On 12/03/2009 07:11 AM, meiko rachimow wrote:
> > Hi
> >
> > How can I call a function defined in a python module from c++,
> > if I have to give **kwargs parameter...
> >
> > example.py:
> >
> > def hello(**kwargs):
> >     for key, value in kwargs.items():
> >         print key, " - ",  value
> >
> >
> > c++:
> > using namespace boost::python;
> >
> > object fun = import("example").attr("hello")
> > fun()
> >
> > int number = 42
> > std::wstring name = "M?hre"
> >
> > dict kwargs;
> > kwargs["Number"] = number;
> > kwargs["Name"] = name;
> >
> > fun(...) ???
> >
> > What should i do ?
>
>
> fun(**kwargs);
>
>
>     Stefan
>
> --
>
>       ...ich hab' noch einen Koffer in Berlin...
>
_______________________________________________
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to