[SciPy-user] Error message I don't understand

Robert Kern rkern at ucsd.edu
Thu Jul 28 14:26:10 CDT 2005

Christian Meesters wrote:
> Hi
> I get this weird Traceback from my script:
> Traceback (most recent call last):
>   File "FP.py", line 111, in ?
>     main()
>   File "FP.py", line 67, in main
>     fitter(OD,ml)
>   File "FP.py", line 98, in fitter
>     tck = interpolate.splrep(ml,OD)
>   File "/platlib/scipy/interpolate/fitpack.py", line 339, in splrep
> SystemError: error return without exception set
> The "fitter"-function so far contains only this line which causes the 
> error. 'OD' and 'ml' are array objects. Running the example code from 
> the tutorial does not result in any error. (And looking into fitpack.py 
> didn't help.)
> Has anybody seen this error before and knows how to solve the problem? 
> It's probably something really stupid, but I failed finding the solution.

It's an obscure error stating that somewhere inside the extension 
module, a function returned NULL instead of a real pointer to a 
PyObject. That's the signal for raising an error in extension functions. 
However, there is a bug somewhere, and the actual exception has not been 

Looking at the source, I believe that the bug is on line 367 of 
Lib/interpolate/__fitpack.h in fitpack_curfit(). It's just after the 
call to the computation routine:

   if (ier==10) goto fail;

An appropriate exception needs to be set here.

In the meantime, here is the FITPACK documentation about this error code:

c    ier=10 : error. on entry, the input data are controlled on validity
c             the following restrictions must be satisfied.
c             -1<=iopt<=1, 1<=k<=5, m>k, nest>2*k+2, w(i)>0,i=1,2,...,m
c             xb<=x(1)<x(2)<...<x(m)<=xe, lwrk>=(k+1)*m+nest*(7+3*k)
c             if iopt=-1: 2*k+2<=n<=min(nest,m+k+1)
c                         xb<t(k+2)<t(k+3)<...<t(n-k-1)<xe
c                       the schoenberg-whitney conditions, i.e. there
c                       must be a subset of data points xx(j) such that
c                         t(j) < xx(j) < t(j+k+1), j=1,2,...,n-k-1
c             if iopt>=0: s>=0
c                         if s=0 : nest >= m+k+1
c             if one of these conditions is found to be violated,control
c             is immediately repassed to the calling program. in that
c             case there is no approximation returned.

Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter

More information about the SciPy-user mailing list