473,511 Members | 14,975 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

call static function from extension module - syntaxerror

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/writi...ng_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

Dec 23 '05 #1
1 1653
Todd wrote:
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/writi...ng_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??


exec is a reserved word.
exec 'print 1' 1 exec = 1

File "<stdin>", line 1
exec = 1
^
SyntaxError: invalid syntax

--
Erik Max Francis && ma*@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
We have lingered long enough on the shores of the cosmic ocean.
-- Carl Sagan, 1934-1996
Dec 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1579
by: Dario Gonzalez | last post by:
Hi all, I've just finished my first dynamically-loadable-cpp-implemented PHP extension and now I need to know how to call a userland PHP function from inside the extension. I need to use...
2
18561
by: Michael Strorm | last post by:
Hi, I'm using PHP 4.3.9 with Apache 2.0, and keep getting the error " PHP Fatal error: Call to undefined function: domxml_open_file() in /var/www/html/php/domtest.php on line 8" (from the...
26
3095
by: Adam Warner | last post by:
Hello all, I'm very new to C but I have a number of years of Common Lisp programming experience. I'm trying to figure out ways of translating higher order concepts such as closures into C. The...
5
2282
by: SStory | last post by:
Hi all, I really needed to get the icons associated with each file that I want to show in a listview. I used the follow modified code sniplets found on the internet. I have left in...
2
2496
by: Marek | last post by:
Hi I'm trying to call a native C++ dll using the following code (both C# and C++ code segments included). When I make the call to the method (AddTwoDoubles) that has no return value all is fine. ...
6
24259
by: Fuzzyman | last post by:
What gives ? >>> a = >>> def f(): return a >>> f() >>> a.append(3) >>> f()
1
2304
by: Jarle Aase | last post by:
Hi, I wrote a multilanguage cms system a few years ago. Different languages are handled by loading php-files where each language-specific string is assigned to a normal php-variable ($LNG...
0
1141
by: tomb | last post by:
Can anybody help me by checking if I have correct call signatures? In my C# Windows Form project (VS2008) I am using dll which has been written for Visual C++ 6.0: This function code is used to...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5676
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5077
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1583
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.