I'd like to create a python object with some attributes in C++, and return it
to python. Something like this:
Plugin_Info *pinfo = get_plugin_info_i(i);
bp::object plugin; // this creates None; how can I make an empty class?
plugin.attr("name") = std::string(pinfo->plugin_name);
plugin.attr("category") = std::string(pinfo->category);
plugin.attr("n_effects") = (int)pinfo->n_effects;
plugin.attr("n_inputs") = (int)pinfo->n_inputs;
plugin.attr("custom_p") = (int)pinfo->custom_p;
effect_list.append(plugin);
But this fails on the third line, because the "plugin" object is None, and None
has no attributes. Instead of None, I'd like to create a simple empty python
class I can add attributes to. How can I do that? (Yes, I could use a dict
instead but the python side would like to see attributes with values rather
than a dict.)
--
. . . . . . . . . . . . . . . . . . . . . .
Gary Oberbrunner [email protected]
VP Engineering Tel: 617-492-2888
GenArts, Inc. www.genarts.com
_______________________________________________
Cplusplus-sig mailing list
[email protected]
https://mail.python.org/mailman/listinfo/cplusplus-sig