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

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -