call static function from extension module - syntaxerror

Todd goldfita at signalsguru.net
Fri Dec 23 00:41:27 EST 2005


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.

>>> ast_man.exec
  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




More information about the Python-list mailing list