MM
2015-09-07 22:02:46 UTC
I thought I'd post this SO question here as well, thanks:
I exposed boost::gregorian::date with the following:
date_from_python_date{};
to_python_converter<date, date_to_python_date, true>{};
where *date_to_python_date* is a struct with the right convert function: it
converts it to a python datetime.date. Some c++ functions return date and
calling them from python works.
At a later stage, I have a c++ class
class F {/// ....public:
boost::gregorian::date start;};
which I register with:
class_<F, F*, bases<B>>("F")
.def_readwrite("start", &F::start, "FTD");
I do this after having python-registered date. I then obtain an instance f
of the F wrapper. But then, when I print
f.start
The error is:
No Python class registered for C++ class boost::gregorian::date
I exposed boost::gregorian::date with the following:
date_from_python_date{};
to_python_converter<date, date_to_python_date, true>{};
where *date_to_python_date* is a struct with the right convert function: it
converts it to a python datetime.date. Some c++ functions return date and
calling them from python works.
At a later stage, I have a c++ class
class F {/// ....public:
boost::gregorian::date start;};
which I register with:
class_<F, F*, bases<B>>("F")
.def_readwrite("start", &F::start, "FTD");
I do this after having python-registered date. I then obtain an instance f
of the F wrapper. But then, when I print
f.start
The error is:
No Python class registered for C++ class boost::gregorian::date