[SciPy-User] leastsq and cython

Warren Weckesser warren.weckesser@enthought....
Sat Sep 25 16:45:08 CDT 2010


  On 9/25/10 4:27 PM, Charles R Harris wrote:
>
>
> On Sat, Sep 25, 2010 at 3:03 PM, David Baddeley 
> <david_baddeley@yahoo.com.au <mailto:david_baddeley@yahoo.com.au>> wrote:
>
>     I've,  run into a similar problem, it's due to the fact that
>     native methods (ie
>     ones loaded from c libraries) are not quite the same as pure
>     python function
>     objects & don't possess all the nice attributes. It's been a
>     while, but I seem
>     to remember that this error crops up when leastsq is trying to
>     print some form
>     of status message with the function name in it. I've circumvented
>     the problem by
>     making a thin python wrapper function which just calls my c
>     method. This works,
>     but is not ideal, as you introduce additional function call
>     overhead. If anyone
>     out there knows of a better solution I'd also be interested.
>
>
> Maybe it shouldn't try to print the function name? The context of the 
> message might be enough.
>


The function 'check_func' in minpack.py uses the attribute 'func_name' 
in an error message.  I'm tweaking 'check_func' now so that it first 
checks for the 'func_name' attribute before trying to use it.

Any suggestions for incorporating a cython or ctypes function into a 
test, so I can include tests of the change?

Warren

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100925/c8596273/attachment.html 


More information about the SciPy-User mailing list