SystemError: error return without exception set

MRAB python at mrabarnett.plus.com
Fri Feb 26 14:31:32 EST 2010


Shailendra wrote:
> Hi All,
> I am getting error in "SystemError: error return without exception
> set" which i am not able debug. I made following test program which
> gives same error.
> 
> =========test.py==============
> 
> import numpy
> 
> class testClass:
>     def __init__(self,param1=1,param2=2):
>         self.param1,self.param2=param1,param2
> 
>     def __str__(self):
>         return 'param1=%d param2=%d'%(self.param1,self.param2)
> 
> 
> class makeLotOftestClass:
>     def __init__(self,paramlist1=None,paramlist2=None):
>         self.holder= numpy.empty((len(paramlist1),len(paramlist2)))
>         for i in range(len(paramlist1)):
>             for j in range(len(paramlist2)):
> 
> self.holder[i,j]=testClass(param1=paramlist1[i],param2=paramlist2[j])
> 
>     def __str__():
>         str=''
>         for testclass in numpy.raven(self.holder):
>             str=str+testclass.__str__()
>         return str
> 
> if __name__=='__main__':
>     lotofclass=makeLotOftestClass(paramlist1=[10,20,30,40],paramlist2=[110,120,130,140])
>     print lotofclass
> 
> ==============================================
> 
> $ python test.py
> Traceback (most recent call last):
>   File "test.py", line 25, in <module>
>     lotofclass=makeLotOftestClass(paramlist1=[10,20,30,40],paramlist2=[110,120,130,140])
>   File "test.py", line 16, in __init__
>     self.holder[i,j]=testClass(param1=paramlist1[i],param2=paramlist2[j])
> SystemError: error return without exception set
> 
> Can someone point out why is this exception. It seems to be a simple
> code. Google search for the error message did not help much.
> 
As I see it, there are 2 problems here:

1. numpy arrays contain numbers, but what you're trying to put into the
array are not numbers.

2. The numpy module is trying to raise an exception but it isn't setting
up the exception correctly internally, which is a bug in numpy itself.



More information about the Python-list mailing list