[IPython-dev] Ipython output uses the previous version of the file to show wrong code line.
Éric Depagne
eric at depagne.org
Sat Sep 14 07:02:14 EDT 2013
Hi all.
This is probably something I'm doing wrong, but I cannot figure out what.
When I run a script in ipython (started with ipython qtconsole --pylab=qt, ipython
version 1.1.0, python 2.7.5), ipython warns me of errors, and tells me what line to look
at. My problem is that when ipython outputs which line to look at, it will parse the
previous version of the file, instead of the current one, albeit indicating me the correct
line number.
Here is a short example of what happens (I have added the line number to the output
of the !more command to make things easier to follow. The Numbers from 1 to 5 are
not part of the python file).
In [*1*]: cd ~/Programmes/Python/Crosstalk/
/home/usertest/Programmes/Python/Crosstalk
In [*2*]: run test.py
File "/home/usertest/Programmes/Python/Crosstalk/test.py", line 3
b = a2/
^
SyntaxError: invalid syntax
In [*3*]: !more test.py
1 #!/usr/bin/python
2 a = 2
3 b = a2/
4 print b
In [*4*]: !more test.py
1 #!/usr/bin/python
2 a = 2
3
4 b = a2/
5 print b
In [*5*]: run test.py
File "/home/usertest/Programmes/Python/Crosstalk/test.py", line 4
print b
^
SyntaxError: invalid syntax
So the first pass detects that the line 3 is wrong. Then I modify the file to add a blank
line before. Thus now, it tells me line 4 is wrong. But then it show the content of line
for in the previous version of my file, instead of the current one (thus the "print b"
instead of the "b = a2/" ).
I've already removed my .config/.ipython directory (in fact, I've done this test with a
newly created testuser, and it still shows the same behaviour.
Of course, when the faulty line is correct, everything works, but it does not change the
problem : if I "uncorrect" the line to make it wrong, the same behaviour reoccurs.
I must be doing something wrong, but can't figure out what. Any idea welcome!
Thx.
Éric.
--
Un clavier azerty en vaut deux
----------------------------------------------------------
Éric Depagne eric at depagne.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20130914/dc6a8bf1/attachment.html>
More information about the IPython-dev
mailing list