Newbie question: importing module from C

Discussion in 'Python' started by nick, Nov 28, 2003.

  1. nick

    nick Guest

    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
     
    nick, Nov 28, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. plb
    Replies:
    2
    Views:
    357
  2. James Stroud

    Module Importing Question

    James Stroud, Oct 22, 2005, in forum: Python
    Replies:
    1
    Views:
    283
    Kent Johnson
    Oct 22, 2005
  3. Pradnyesh Sawant

    doubt with importing module, given module name

    Pradnyesh Sawant, Apr 9, 2007, in forum: Python
    Replies:
    0
    Views:
    286
    Pradnyesh Sawant
    Apr 9, 2007
  4. -ecosys.com
    Replies:
    4
    Views:
    308
    Calvin Spealman
    Sep 28, 2007
  5. cronoklee
    Replies:
    1
    Views:
    208
    shearichard
    Dec 17, 2010
Loading...

Share This Page