ipython / ipython

Official repository for IPython itself. Other repos in the IPython organization contain things like the website, documentation builds, etc.
https://ipython.readthedocs.org
BSD 3-Clause "New" or "Revised" License
16.3k stars 4.45k forks source link

ERROR: Internal Python error in the inspect module. #2512

Closed femibyte closed 12 years ago

femibyte commented 12 years ago

Hi, I'm using iPython 0.13 and got the following error:

In [109]: run gaussElim.py

In [110]: slv(B,b)

Traceback (most recent call last): File "/Library/Python/2.7/site-packages/ipython-0.13-py2.7.egg/IPython/core/ultratb.py", line 756, in structured_traceback records = _fixed_getinnerframes(etb, context, tb_offset) File "/Library/Python/2.7/site-packages/ipython-0.13-py2.7.egg/IPython/core/ultratb.py", line 242, in _fixed_getinnerframes records = fix_frame_records_filenames(inspect.getinnerframes(etb, context)) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py", line 1035, in getinnerframes framelist.append((tb.tb_frame,) + getframeinfo(tb, context)) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py", line 999, in getframeinfo lines, lnum = findsource(frame) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py", line 578, in findsource if pat.match(lines[lnum]): break IndexError: list index out of range ERROR: Internal Python error in the inspect module. Below is the traceback from this internal error.

Unfortunately, your original traceback can not be constructed.

Here is my code (gaussElim.py):

from numpy import *

def slu(A1):

square LU factorization with no row exchanges

A=matrix(A1)
(n,n)=shape(A)
L=matrix(zeros((n,n)))
U=matrix(zeros((n,n)))
tol=1.e-6
for k in range(n):
    if abs(A[k,k]) < tol:
        return
    L[k,k]=1
    print "L=" + str(L)
    for i in range(k+1, n):   # Multipliers for column k are put into L
        L[i,k]=A[i,k]/A[k,k]
        for j in range(k, n): #Elimination beyond row k and column k
            A[i,j]=A[i,j]-L[i,k]*A[k,j]  # Matrix still called A
    for j in range(k-1, n):
        U[k,j]=A[k,j]
return(L,U)

def slv(A1,b1):

Solve Ax=b using L & U from slu(A). No row exchanges !!

[L,U]=slu(A)
(n,n)=shape(A)
c=zeros(n)
x=zeros(n)
s=0
for k in range(n):
    for j in range(k-1):
        s=s+L[k,j]_c[j]
    c[k]=b[k]-s    #Forward elimination to solve Lc=b
for k in range(n-1,-1,0): #Going backwards from x(n-1) to x(0) 
    for j in range(k+1,n):
        t=t+U[k,j]_x[j]
    x[k]=(c[k]-t)/U[k,k]
x=transpose(x)
return x

A=mat([[2,1],[6,8]]

run gaussElim.py

slu(A)

B=mat([[1,2],[4,9]])

b=array([5,21])

slv(B,b)

takluyver commented 12 years ago

Thanks. I think this is the same as #1456, which should have been fixed by PR #2232. The fix will be in 0.14.

takluyver commented 12 years ago

(Feel free to reopen if you can reproduce the error on master)

femibyte commented 12 years ago

Ok, thanks. When is 0.14 supposed to be released?

takluyver commented 12 years ago

There's no date set yet, but probably around the end of the year.

xgdgsc commented 11 years ago

When is 0.14 supposed to be released?

minrk commented 11 years ago

1.0 will be released in July.

isghost commented 9 years ago

I'm using Ipython 2.3.1,if path including chinese,will get this error