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 <rachi...@googlemail.com> > To: cplusplus-sig@python.org > Subject: [C++-sig] boost.python: call python function with kwargs from > c++ > Message-ID: > <6a5b23630912030411m5be57968t9d8a2a7baf43f...@mail.gmail.com> > 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 <seef...@sympatico.ca> > To: cplusplus-sig@python.org > Subject: Re: [C++-sig] boost.python: call python function with kwargs > from c++ > Message-ID: <4b17b908.7000...@sympatico.ca> > 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 Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig