Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Newbie question: importing module from C

Thread Tools

Newbie question: importing module from C

Posts: n/a
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");

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,
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing a certiticate server on CSS 11503 with SSL module from RSA KEON server nabla Cisco 2 03-30-2010 02:17 PM
Importing Module To Use Variables In A Second Module Python 4 09-28-2007 01:17 PM
doubt with importing module, given module name Pradnyesh Sawant Python 0 04-09-2007 05:22 PM
Re: module docstring, documentation,anything? please note is the module type/object NOT some module Maric Michaud Python 0 06-24-2006 12:42 PM
How to keep a module with the same name as a module it is importing from importing itself? plb Python 2 02-08-2005 03:14 PM