Newbie question: importing module from C

N

nick

I'm trying to load the email.Message module from C and can't figure
out what I'm doing wrong. What's wrong with the following code?

PyObject *pMessage;

pMessage = PyImport_ImportModule("email.Message");

if (pMessage == NULL) {
printf("Null module\n");
exit(1);
}


I know my environment is set up correctly because if I change
"email.Message" to "email", then I can successfully load the email
package. From the email package, I can then get the dictionary and
see the reference to the "Message", but don't know how to load it.

Ultimately, what I want to do is instantiate an email.Message, fill it
in, then send it off to the Python environment.

I'm using Python 2.3.2 on Red Hat 9.0

thanks in advance,
nick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top