473,549 Members | 2,331 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pyrex-0.9.3: definition mismatch with distutils of Python24

Now that I've got my extension building machine using the VC++ Toolkit
2003 up and running I'm keen on using Pyrex (Pyrex-0.9.3,
Python-2.4.0).

But the definition of the swig_sources() method seems to have changed.

When I try to build the examples from Pyrex I get a TypeError:
c:\Pyrex-0.9.3\Demos> python Setup.py build_ext --inplace
running build_ext
building 'primes' extension
[...]
File "C:\Python24\li b\distutils\com mand\build_ext. py", line 442, in
build_extension
sources = self.swig_sourc es(sources, ext)
TypeError: swig_sources() takes exactly 2 arguments (3 given)
I can see that Pyrex.Distutils .build_ext.py subclasses
distutils.comma nd.build_ext.bu ild_ext, and the number of arguments of
the swig_sources method seems to have changed.

Pyrex uses:

def swig_sources (self, sources):

whereas the distutils use:

def swig_sources (self, sources, extension):

If I just add the "extension" arg to the Pyrex definitions everything
seems to work. But I have to admit that I don't really know what I'm
doing here and I feel sorry I can't contribute more than just
reporting the error.

mb - Martin Bless


Jul 18 '05 #1
1 3571
mb@muenster.de (Martin Bless) writes:
Now that I've got my extension building machine using the VC++ Toolkit
2003 up and running I'm keen on using Pyrex (Pyrex-0.9.3,
Python-2.4.0).

But the definition of the swig_sources() method seems to have changed.

When I try to build the examples from Pyrex I get a TypeError:
c:\Pyrex-0.9.3\Demos> python Setup.py build_ext --inplace
running build_ext
building 'primes' extension
[...]
File "C:\Python24\li b\distutils\com mand\build_ext. py", line 442, in
build_extension
sources = self.swig_sourc es(sources, ext)
TypeError: swig_sources() takes exactly 2 arguments (3 given)
I can see that Pyrex.Distutils .build_ext.py subclasses
distutils.comma nd.build_ext.bu ild_ext, and the number of arguments of
the swig_sources method seems to have changed.

Pyrex uses:

def swig_sources (self, sources):

whereas the distutils use:

def swig_sources (self, sources, extension):

If I just add the "extension" arg to the Pyrex definitions everything
seems to work. But I have to admit that I don't really know what I'm
doing here and I feel sorry I can't contribute more than just
reporting the error.


Yep, that's it. Greg must know now, it's been reported a few times.
You'll want to change it to

def swig_sources(se lf, sources, extension=None) :

so that if you use an older python it won't complain about missing
arguments.

--
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)phy sics(dot)mcmast er(dot)ca
Jul 18 '05 #2

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

Similar topics

3
2285
by: Gary Stephenson | last post by:
I'm getting a clean generate, compile and link from my .pyx script, but when I attempt to run the resultant .exe, I get: "The procedure entry point Py_NoneStruct could not be located in the dynamic link library python23.dll" Can anybody provide me with a clue here? I've already cut down my script to remove all references to None,...
10
2021
by: Kyler Laird | last post by:
I need to submit C/C++ code for a class. (It's not a programming class. The choice of language is inertial. I think that it mostly serves to distract students from the course subject.) I'm fairly fluent with C but it hurts to think about writing in C when Python is *so* much more appropriate for these operations. I'd like to keep my...
1
1664
by: Paul Prescod | last post by:
PyCon 2004 Slides on "Extending Python with Pyrex" PDF: http://www.prescod.net/pyrex/ExtendingPythonWithPyrex.pdf PPT: http://www.prescod.net/pyrex/ExtendingPythonWithPyrex.ppt Pycon 2004 Slides on "Optimizing Python code with Pyrex" PDF: http://www.prescod.net/pyrex/OptimizingPythonWithPyrex.pdf PPT:...
4
2066
by: Kyler Laird | last post by:
I mentioned earlier that I started using Pyrex because I'm taking a computer vision course that requires all assignments to be submitted as C(++). While I could write C it would hurt me to do so and certainly distract me from the computer vision aspects. I like using Python these days and Pyrex looked like a good solution. (BTW, on the...
6
1929
by: SeeBelow | last post by:
I just read "about Pyrex" at http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/version/Doc/About.html It seems that it is not compiled into machine code, as C would be, and therefore it does not offer the only valid reason for using C, which is for an increase in execution speed. The word "speed" does not appear on the above web page. ...
4
1632
by: Carl | last post by:
I have recently started to use Pyrex and am amazed by it's useability. Are there any alternatives to Pyrex? One thing that I haven't figured out is how to embed pure C/C++ source code into Pyrex. For example, if you have a bunch of C files that you want to use together with some Python code snippets, how do you practically achieve this...
27
3949
by: Julien Fiore | last post by:
Do you wand to install Pyrex on Windows ? Here is a step-by-step guide explaining: A) how to install Pyrex on Windows XP. B) how to compile a Pyrex module. Julien Fiore, U. of Geneva
11
1974
by: Jim Lewis | last post by:
Has anyone found a good link on exactly how to speed up code using pyrex? I found various info but the focus is usually not on code speedup.
7
2036
by: Jim Lewis | last post by:
I'm trying to move a function into pyrex for speed. The python side needs to pass a list to the pyrex function. Do I need to convert to array or something so pyrex can generate tight code? I'm not clear how to do this.
3
1486
by: skip | last post by:
I'm using Pyrex 0.9.5.1a. I have this simple Pyrex module: cdef class Foo: cdef public char attr def __init__(self): self.attr = 0 class Bar(Foo): def __init__(self):
0
7546
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7471
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7740
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. ...
0
7985
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7830
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...
0
5111
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3517
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...
1
1962
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
1
1082
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.