Greg Ewing | 11 Feb 01:05 2014
Picon
Picon

Re: (no subject)

Kevin Conway wrote:
> Is it OK to just respond to your email, or
> should I be responding to the list explicitly somehow?

Sorry, I hadn't noticed that the original message was from
the list, and I think I may have just replied to you.
Normally I answer list questions on the list so that
others can benefit from the answers, but my mail client
is unfortunately not very smart about that sort of thing.
I'm putting it back on the list now.

>    And here is the version 0.9.8.6 pyrexc from our newer machine:
> 
> cat /usr/local/bin/pyrexc
> 
> #!/usr/bin/python
> 
> #
> #   Pyrex -- Main Program, Unix
> #
> 
> from Pyrex.Compiler.Main import main
> main(command_line = 1)

How exactly did you install Pyrex 0.9.9?

I suspect that you have more than one version of Python
installed, and whatever method you used resulted in
Pyrex getting put into a different Python from the one
that /usr/bin/python runs.
(Continue reading)

Kevin Conway | 10 Feb 21:01 2014

(no subject)

   I tried to build Pyrex 0.9.9 from the tarball on the website. The build appeared to run properly, and the egg_info file is updated, but the  resulting file /usr/local/bin/pyrexc is still 0.9.8.6, according to the result of /usr/local/bin/pyrexc –v.

   I tried copying in a 0.9.9 version of pyrexc from another similar machine, but then …/pyrexc –v fails with errors.

   The two machines are Ubuntu Linux 12.04 LTS  and  Ubuntu 13.04 respectively, and both have Cloud Biolinux installed. We installed an application package RSeQC successfully on the older machine, but the installation failed on the newer machine. The only related software that was older on the newer machine was Pyrex (0.9.8.6 versus 0.9.9). This matched the error messages from the RSeQC build, where some lines of Python code had syntax errors when compiled with pyrexc. Thus, I tried installing Pyrex 0.9.9 on the newer machine, but the pyrexc file is still 0.9.8.6, and the RSeQC build is still failing.

   Thanks in advance for any help you can provide. If more information would help, just let me know. Googling this problem hasn’t turned up much. I am also trolling through the CloudBiolinux web site. My notes are included below:

 

downloaded and built Pyrex 0.9.9

   but ended up with pyrexc 0.9.8.6

   here are the build results

      ### <at> #####:/home/####/Pyrex/Pyrex-0.9.9# python setup.py install

      running install

      running build

      running build_py

      running build_scripts

      running install_lib

      running install_scripts

      changing mode of /usr/local/bin/pyrexc to 755

      running install_data

      running install_egg_info

      Removing /usr/local/lib/python2.7/dist-packages/Pyrex-0.9.9.egg-info

      Writing /usr/local/lib/python2.7/dist-packages/Pyrex-0.9.9.egg-info

   egg-info says 0.9.9

      but pyrexc is 0.9.8.6

      and build of RSeQC fails as before

 

_______________________________________________
Pyrex mailing list
Pyrex <at> lists.copyleft.no
http://lists.copyleft.no/mailman/listinfo/pyrex
Claudio Freire | 31 Jul 20:33 2013
Picon

Segfaults and leaked exceptions in 0.9.9

This is interestingly new (I think this didn't happen in 0.9.8, but I
didn't check)

test.pyx:

. def fault():
.     try:
.         return {}[3]
.     except:
.         return None
.
. def bork():
.     cdef object rv
.     try:
.         rv = {}[3]
.     except:
.         rv = None
.     return rv

test session:

Python 2.7.3 (default, Apr 14 2012, 08:58:41) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import lrucache
>>> lrucache.bork()
>>> 3
KeyError: 3
>>> lrucache.fault()
Segmentation fault
Anthony Percy | 21 Jul 15:19 2013
Picon

My Email account was jacked by a dns poisoning attack...

Hi all ,
Please ignore any email received from me in the last 6 hours...
My gmail account was hacked...

Sorry about this...

Regards

Ap
_______________________________________________
Pyrex mailing list
Pyrex <at> lists.copyleft.no
http://lists.copyleft.no/mailman/listinfo/pyrex
Anthony Percy | 21 Jul 09:44 2013
Picon

Re: anthcp

http://pythonpenispills.com/aekvdp/jdwcyop.gdgfabsqtbcbin

anthcp

7/21/2013 8:44:08 AM
Lynn Oliver | 9 Apr 01:01 2012
Picon

Pyrex on Win7-64

I'm using Pyrex to build PyPortMidi.  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: 
  1. Downloaded Pyrex-0.9.9.win32.exe and ran it.
  2. 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
building 'pypm' extension
C:\Python27\Scripts\gcc.exe -mno-cygwin -mdll -O -Wall -DMS_WIN64 -IC:\Python27\include -IC:\Python27\PC -c pypm.c -o bu
ild\temp.win-amd64-2.7\Release\pypm.o
pypm.c:1:2: error: #error Do not use this file, it is the result of a failed Pyrex compilation.
error: command 'gcc' failed with exit status 1

This error didn't occur on OS X.  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:
        pmNoError = 0,
        pmHostError = -10000,
        pmInvalidDeviceId, #/* out of range or output device when input is requested or vice versa */
        pmInsufficientMemory,
        pmBufferTooSmall,
        pmBufferOverflow,
        pmBadPtr,
        pmBadData, #/* illegal midi data, e.g. missing EOX */
        pmInternalError,
        pmBufferMaxSize, #/* buffer is already as large as it can be */

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)):
            err = Pm_Read(self.midi,buffer,1)
            if err < 0: raise Exception, Pm_GetErrorText(err)


The error was generated at: ExprNodes.py:590
Here are some of the local variables at the point the error was posted:

self.pos ('c:\\Users\\Lynn Oliver\\Desktop\\pyPortMidi\\pypm.pyx', 357, 21)

type.__doc__ None
type.__module__ 'Pyrex.Compiler.PyrexTypes'
type.cname 'PmError'
type.from_py_function 'PyInt_AsLong'
type.is_enum 1
type.name 'PmError'
type.rank -1
type.signed 1
type.to_py_function 'PyInt_FromLong'
type.typedef_flagis 1
type.values []
self.pos ('c:\\Users\\Lynn Oliver\\Desktop\\pyPortMidi\\pypm.pyx', 357, 21)
type.is_int 0
type.is_error 0

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

Thanks,
LMO

_______________________________________________
Pyrex mailing list
Pyrex <at> lists.copyleft.no
http://lists.copyleft.no/mailman/listinfo/pyrex
Claudio Freire | 4 Nov 22:59 2011
Picon

Segfault when using [nogc]

There's a segfault-kind of bug in code generation for [nogc] classes, in 0.9.9.

Even when the type object is of non-gc kind, it foces the GC
deallocator, which ends up segfaulting, due to
Compiler/TypeSlots.py:600:
GCDependentSlot("tp_free", "0", "_PyObject_GC_Del", dynamic = 1)

It's fixed by replacing, in Compiler/TypeSlots.py, line 182:

if scope.has_pyobject_attrs:

with

if scope.has_pyobject_attrs and not scope.no_gc:
Jan | 24 Sep 19:28 2011
Picon

create win32 dll with multiple export functions

Hello,

Could someone please tell me, if it is possible to create classic win32 dll with
multiple export functions with Pyrex? From what I have read, I understand that
__declspec(dllexport) directive is declared for the main function only. I need
to bind that dll to language called unrealscript, where you could bind win32
dll's. Here is a sample from unrealscript documentation of how thee dll should
be written in C.

extern "C"
{
struct FVector
{
float x,y,z;
};

__declspec(dllexport) void CallDLL1(wchar_t* s)
{
MessageBox(0, s, L"Inside the DLL: CallDLL1", MB_OK);
// reverse the out parameter string
int len = wcslen(s);
for(int i=0; i<len>>1;i++)
{
wchar_t temp = s[i];
s[i] = s[len-i-1];
s[len-i-1] = temp;
}
}

__declspec(dllexport) FVector* CallDLL2(float x, float y, float z)
{
static FVector result; // declared static so that the struct's memory is still
valid after the function returns.
result.x = x;
result.y = y;
result.z = z;
return &result;
}

thank you for help.....Jan
Samuel Thibault | 20 Feb 19:10 2011

or None / not None

Hello,

I'm getting the following warning with 0.9.9:

brltty/Bindings/Python/brlapi.pyx:439:17: Warning: 'not None' will become the default in a future
version of Pyrex. Use 'or None' to allow passing None.

Adding "or None" indeed makes it disappear, but it's refused by older
versions.  How can I change my source to something that works both with
older and newer versions of pyrexc?

Samuel
Greg Ewing | 1 Dec 01:17 2010
Picon
Picon

Re: profiling in pyrex

Mihai Badoiu wrote:
> what is the best way to profile code written in pyrex?

There are no special tools or techniques that I'm aware of.
Just treat it as you would any other piece of C code.

--

-- 
Greg
Javier Correa | 9 Nov 18:16 2010
Picon

Pointers

I-m new to pyrex and I'm trying to use it to have access to a library (MesaSR, http://www.mesa-imaging.ch/drivers.php), but I can't make use of pointers.

I can't seem to define a function that one of its arguments it's a pointer (a function that initialize the structure). I'm also having troubles with using the SR_GetImage that returns a void* pointer.

My code is as follows:

import numpy

cdef extern from "libMesaSR.h":
   ctypedef SRCAM
   int SR_OpenUSB(SRCAM * cam, unsigned int serial)
   int SR_ReadSerial(SRCAM cam)
   int SR_GetRows(SRCAM cam)
   int SR_GetCols(SRCAM cam)
   void * SR_GetImage(SRCAM cam, unsigned int i)

cdef class MesaSR:
   cdef SRCAM cam 
   cdef int cols
   cdef int rows
   cdef object range_image

   def __init__(self, serial):
      status = SR_OpenUSB(&self.cam, serial)
      self.cols = SR_GetCols(self.cam)
      self.rows = SR_GetRows(self.cam)
      self.range_image = numpy.empty([self.rows, self.cols], 'H')

   def get_image(self):
      cdef void * images
      cdef unsigned int value
      image = SR_GetImage(self.cam, 0)
      for 0 <= i < self.cols:
         for 0 <= j <self.rows:
            value = image[i + j*self.cols]
            self.range_image[j][i] = value

And I'm getting:
mesasr.pyx:5:22: Pointer base type cannot be a Python object
mesasr.pyx:18:22: Cannot take address of Python variable
mesasr.pyx:26:21: Cannot convert 'void *' to Python object

Am I missing something?
--
Javier Correa

Por favor, no imprimas este e-mail si realmente no lo necesitas... Conservar el medio ambiente es nuestra tarea...
Please, don't print this e-mail if it's not needed... preserve the environment is our task...

_______________________________________________
Pyrex mailing list
Pyrex <at> lists.copyleft.no
http://lists.copyleft.no/mailman/listinfo/pyrex

Gmane