[Pyrex] Pyrex on Win7-64

Stefan Behnel stefan_ml at behnel.de
Mon Apr 9 07:45:04 CEST 2012


Hi,

Lynn Oliver, 09.04.2012 01:01:
> I'm using Pyrex to build PyPortMidi.

Is that something you are working on yourself or do you just want to
install it in order to use it?

Does it really need Pyrex to be installed or does it ship with the
generated C sources? If the latter, you could build entirely without Pyrex.


> I was able to get it to work on OS
> X 10.7.3; on win32 (Windows XP) I didn't manage to get Pyrex to work,
> but I was able to get the PyPortMidi library built by copying in the
> output (pypm.c) from OS X.  That didn't work on win64 (Windows 7).
> 
> Working on win64, I tried two different ways to install Pyrex-0.9.9: 
> Downloaded Pyrex-0.9.9.win32.exe and ran it.
> Downloaded Pyrex-0.9.9.zip, unpacked it and ran "python setup.py install"  
> With either installation, when I try to build PyPortMidi I get the same error:
> 
> pyrexc pypm.pyx --> pypm.c
> C:\Users\Lynn Oliver\Desktop\pyPortMidi\pypm.pyx:357:21: Type 'PmError' not acceptable as a boolean
> 
> This error didn't occur on OS X.

Are you using the exact same version of Pyrex there?


> I'm not a C  programmer so it's not clear to me what caused the error; here is the declaration for PmError:  
> 
>     ctypedef enum PmError:
> [...]
> And here is the section of code where the error was flagged, I think...:
> 
>         cdef PmEvent buffer[1]
>         cdef PmError err
>         
>         Pm_SetFilter(self.midi, filters)
>         if err < 0: raise Exception, Pm_GetErrorText(err)
>  357    while(Pm_Poll(self.midi)):

Assuming that Pm_Poll() returns a PmError value, this would indicate that
Pyrex fails to reinterpret an enum value as a bool value here.


> Can anyone suggest what I need to do to get this working?

I would suggest using Cython instead of Pyrex (it's a largely enhanced
successor), but I can't guarantee that it will be a drop-in replacement for
the entire code base of this library. At least, it won't show this
particular problem, so it's worth a try.

In any case, and in particular if you're just trying to install PyPortMidi
as a user, you should also contact the authors and report the problem there.

Stefan



More information about the Pyrex mailing list