473,763 Members | 1,377 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,ME TH_VARARGS,"Exe cute Asterisk commands."},
{NULL,NULL,0,NU LL}
};

What might be my problem??

thanks

Dec 23 '05 #1
1 1665
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,ME TH_VARARGS,"Exe cute Asterisk commands."},
{NULL,NULL,0,NU LL}
};

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
1590
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 Headers() to be able to download a file that is generated by my extension. So far I've used this function from the php-script that uses my extension, but I'd like to embed this functionallity into it. I've searched the php-sources to see the...
2
18581
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 Apache error log). Here's the page itself:-
26
3132
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 code will not be idiomatic C. GCC has an extension to ISO C that permits nested functions: <http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html> For implementing closures they have a serious limitation:
5
2317
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 commented code for anyone else who may be looking to do the same.
2
2515
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. When I try and call a function that returns a double (AddTwoDoubles2) I get the following message: PInvokeStackImbalance was detected Message: A call to PInvoke function 'tempModule!<Module>::AddTwoDoubles2' has unbalanced the stack. This is...
6
24339
by: Fuzzyman | last post by:
What gives ? >>> a = >>> def f(): return a >>> f() >>> a.append(3) >>> f()
1
2320
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 array). This loading takes place for each request. Now I'm developing a backend server in C++ that will allow some better security-checking, session management and caching. The backend server has a
0
1147
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 start receive active message of ioLogik 2000 Ethernet Module: C/C++ int Message2K_Start(&nbsp; int iProtocol, WORD wPort, pfnCALLBACK& iProcAddress);
0
10145
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9822
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7366
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5270
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
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 we have to send another system
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.