Python 3 C API. Initialising MIMEText object fails -
i looking embed python c program. among other things python after sending email. have no trouble using base types c, have trouble using other objects within library.
i looking instantiate mimetext instance by:
pyobject *mimetextmodule = pyimport_importmodule("email.mime.text"); pyobject* sys_mod_dict = pyimport_getmoduledict(); pyobject* main_mod = pymapping_getitemstring(sys_mod_dict, "__main__"); pyobject* mimetext = pyobject_callmethod(main_mod, "mimetext", "s", "test email body");
but mimetext null. have tried below, same result:
pyobject *mimetextmodule = pyimport_importmodule("email.mime.text"); pyobject *mimetextclass = pyobject_getattrstring(mimetextmodule, "mimetext"); pyobject *mimetext = pyobject_callmethod(mimetextclass, "__init__", "s", "test email body");
help appreciated.
returning null
means exception occurred , need check is.
if want instantiate class same way in c in python: call it.
Comments
Post a Comment