call static function from extension module - syntaxerror

T

Todd

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
 
E

Erik Max Francis

Todd said:
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??

exec is a reserved word.
File "<stdin>", line 1
exec = 1
^
SyntaxError: invalid syntax
 

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,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top