New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERROR: Internal Python error in the inspect module. #1456
Comments
Aha, this rings a bell...does re-enabling the monkeypatch that was disabled in 1cd5a58 fix it? Can you provide steps to reproduce this? |
It happened in a context with a lot of Qt, OpenGL, and PyCUDA going on. There was a bug in my code causing an exception inside the prtparam setter, which was defined like this:
Likely the error was raised from the close() call, which was calling both OpenGL and PyCUDA functions. I was able to repeat it in a few fresh runs, but if I run it with the bug in there now, it produces the perfectly reasonable
|
Hmmm, so you can no longer reproduce it? Looking at the traceback when it was failing, though, it is failing at the point that our monkeypatch was intended to resolve. The error is that it's getting a line number beyond the end of the file. I think that might occur if you're changing the file while the module is loaded, so that the loaded line numbers don't match those on disk. |
No, it's not happening now, but your thought about changing the file makes good sense. The close() function is at the very end of cuda_prt.py, and I've done
so that it automatically updates when I change stuff. |
OK, perhaps we have to re-enable the monkeypatch. I'd prefer to catch the error when it reaches our own code, so we benefit from upstream changes to |
I got the same error in Ubuntu 12.04 (precise) with ipython 0.12.1+dfsg-0ubuntu1 when repeatedly editing a python file and running it in ipython sort of like this: In [423]: run aiclass22_nlp.py In [424]: p = main() edit... edit...In [425]: run aiclass22_nlp.py In [426]: p = main() Unfortunately, your original traceback can not be constructed. |
I've assigned this to myself to try to reproduce the error. |
OK, I've got a reproducible case - Create a file test.py with:
Then %run or import it in IPython, and call Now edit the file to remove the 1 2 3 lines, and without re-running/re-importing, call
Why it's only the second call that fails, I don't know. I'll try to work up a proper test case for this, and then a fix. |
On a freshly installed 0.13, I am able to reproduce the bug with the following code: L = {} f = L['func'] The problem is that the filename supplied to the compile function is an empty string, and inspect.getfile doesn't like an empty filename. If I use '<>' as the filename the backtrace in ipython is fine. |
@rainwoodman That sounds like a related but different bug. If you can reproduce it in master, can you open a new issue for it? |
This sounds like it could be related to the use of linecache in the inspect module. |
Did this ever get fixed? I just saw this start to pop up randomly in an application I'm working on. Partial stack-trace below, removing functions/data that I'm not at liberty to share. File "safelog.py", line 133, in <lambda>
return (lambda text, *args: self.writelog(name, text, args))
File "safelog.py", line 56, in writelog
calframe = inspect.getouterframes(inspect.currentframe())
File "/usr/lib/python2.7/inspect.py", line 1038, in getouterframes
framelist.append((frame,) + getframeinfo(frame, context))
File "/usr/lib/python2.7/inspect.py", line 1013, in getframeinfo
lines, lnum = findsource(frame)
File "/usr/lib/python2.7/inspect.py", line 580, in findsource
if pat.match(lines[lnum]): break
IndexError: list index out of range |
Actually I just got it too when using the wide and deep learning example code with TensorFlow using CUDA. I made a code modification to using training and testing data from the local FS and removed the maybe_download function and saved the py file fast, running the script again. It happened at that point. I thought maybe somehow the file system was out of sync and Python got a handle of an old file and couldn't find the line number. It only happened once so far.
Edit: there's a chance I accidentally saved the script while a previous one was running and the error was from the previous execution. This is what happened when it occurred again. |
Was this ever fixed? Is there a way around this problem? |
As defined by arch/0003-Config-Property-Mutable-vs-Immutable.rst Related: ipython/ipython#1456 Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
As defined by arch/0003-Config-Property-Mutable-vs-Immutable.rst Related: ipython/ipython#1456 Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
As defined by arch/0003-Config-Property-Mutable-vs-Immutable.rst Related: ipython/ipython#1456 Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
As defined by arch/0003-Config-Property-Mutable-vs-Immutable.rst Related: ipython/ipython#1456 Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
As defined by arch/0003-Config-Property-Mutable-vs-Immutable.rst Related: ipython/ipython#1456 Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
As defined by arch/0003-Config-Property-Mutable-vs-Immutable.rst Related: ipython/ipython#1456 Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
As defined by arch/0003-Config-Property-Mutable-vs-Immutable.rst Related: ipython/ipython#1456 Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
Looks like this is related to issue #53. I just got the following in the notebook:
The text was updated successfully, but these errors were encountered: