Python 3 C API. Initialising MIMEText object fails
<p>I am looking to embed Python into a C program. Among other things Python will look after sending email. I have no trouble using the base types from C, but I have trouble using other objects within the library.</p>

<p>I am looking to instantiate a MIMEText instance by:</p>

<pre><code>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");
</code></pre>

<p>but mimeText is NULL. I have also tried the below, with the same result:</p>

<pre><code>PyObject *mimeTextModule = PyImport_ImportModule("email.mime.text");    
PyObject *mimeTextClass = PyObject_GetAttrString(mimeTextModule, "MIMEText");
PyObject *mimeText = PyObject_CallMethod(mimeTextClass, "__init__", "s", "test email body");
</code></pre>

<p>Help appreciated.</p>
