call static function from extension module - syntaxerror

Discussion in 'Python' started by Todd, Dec 23, 2005.

  1. Todd

    Todd Guest

    Hi,

    I'm working right from the example here to make a basic extenstion
    module.
    http://docs.python.org/ext/intro.html
    http://www.dalkescientific.com/writings/diary/archive/2005/04/26/extending_python.html

    I can load my module into python and dir shows my function. But I get
    a syntax error if I try to access it.
    File "<stdin>", line 1
    ast_man.exec
    ^
    SyntaxError: invalid syntax

    However, I can get at it using getattr. I tried compiling myself and
    using setup. My method is defined as

    static PyMethodDef ast_man_methods[] = {
    {"exec",exec,METH_VARARGS,"Execute Asterisk commands."},
    {NULL,NULL,0,NULL}
    };

    What might be my problem??

    thanks
     
    Todd, Dec 23, 2005
    #1
    1. Advertisements

  2. exec is a reserved word.
    File "<stdin>", line 1
    exec = 1
    ^
    SyntaxError: invalid syntax
     
    Erik Max Francis, Dec 23, 2005
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.