<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'DejaVu Sans Mono'; font-size:10pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">Hi all.</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">This is probably something I'm doing wrong, but I cannot figure out what.</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">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.</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">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).</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt; color:#000080;">In [</span><span style=" font-family:'linux biolinum'; font-size:12pt; font-weight:600; color:#000080;">1</span><span style=" font-family:'linux biolinum'; font-size:12pt; color:#000080;">]:</span><span style=" font-family:'linux biolinum'; font-size:12pt;"> cd ~/Programmes/Python/Crosstalk/</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">/home/usertest/Programmes/Python/Crosstalk</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt; color:#000080;">In [</span><span style=" font-family:'linux biolinum'; font-size:12pt; font-weight:600; color:#000080;">2</span><span style=" font-family:'linux biolinum'; font-size:12pt; color:#000080;">]:</span><span style=" font-family:'linux biolinum'; font-size:12pt;"> run test.py</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt; color:#4682b4;"> File </span><span style=" font-family:'linux biolinum'; font-size:12pt; color:#006400;">"/home/usertest/Programmes/Python/Crosstalk/test.py"</span><span style=" font-family:'linux biolinum'; font-size:12pt; color:#4682b4;">, line </span><span style=" font-family:'linux biolinum'; font-size:12pt; color:#006400;">3</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt; color:#a52a2a;"> b = a2/</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt; color:#000000;"> ^</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt; color:#8b0000;">SyntaxError:</span><span style=" font-family:'linux biolinum'; font-size:12pt;"> invalid syntax</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt; color:#000080;">In [</span><span style=" font-family:'linux biolinum'; font-size:12pt; font-weight:600; color:#000080;">3</span><span style=" font-family:'linux biolinum'; font-size:12pt; color:#000080;">]:</span><span style=" font-family:'linux biolinum'; font-size:12pt;"> !more test.py</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">1 #!/usr/bin/python</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">2 a = 2</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">3 b = a2/</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">4 print b</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt; color:#000080;">In [</span><span style=" font-family:'linux biolinum'; font-size:12pt; font-weight:600; color:#000080;">4</span><span style=" font-family:'linux biolinum'; font-size:12pt; color:#000080;">]:</span><span style=" font-family:'linux biolinum'; font-size:12pt;"> !more test.py</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">1 #!/usr/bin/python</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">2 a = 2</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">3 </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">4 b = a2/</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">5 print b</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt; color:#000080;">In [</span><span style=" font-family:'linux biolinum'; font-size:12pt; font-weight:600; color:#000080;">5</span><span style=" font-family:'linux biolinum'; font-size:12pt; color:#000080;">]:</span><span style=" font-family:'linux biolinum'; font-size:12pt;"> run test.py</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt; color:#4682b4;"> File </span><span style=" font-family:'linux biolinum'; font-size:12pt; color:#006400;">"/home/usertest/Programmes/Python/Crosstalk/test.py"</span><span style=" font-family:'linux biolinum'; font-size:12pt; color:#4682b4;">, line </span><span style=" font-family:'linux biolinum'; font-size:12pt; color:#006400;">4</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt; color:#a52a2a;"> print b</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt; color:#000000;"> ^</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt; color:#8b0000;">SyntaxError:</span><span style=" font-family:'linux biolinum'; font-size:12pt;"> invalid syntax</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">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/" ).</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">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.</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">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.</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">I must be doing something wrong, but can't figure out what. Any idea welcome!</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">Thx.</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">Éric.</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">-- </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">Un clavier azerty en vaut deux</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">----------------------------------------------------------</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'linux biolinum'; font-size:12pt;">Éric Depagne eric@depagne.org</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p></body></html>