Python console stdin is broken
I observe this in the nightly build of Slicer, but I suspect the culprit is the recent changes to the Python console.
Any command that inputs stdin causes the cursor to jump to where the command was entered:
input('\nTest:')
A more severe version is when using pdb, which altogether prevents entering debug commands:
1 / 0
import pdb
pdb.pm()
Thanks for the report.
I suspect the culprit is the recent changes to the Python console
Most likely.
Would you have time to help address the issue ?
Did input command work before? Regardless where the cursor position is, whatever you enter as a response to input, it will be interpreted as a command (I think this is not a new behavior).
The refactoring changed interaction between entering commands and printing output. I've fixed an issue of commands incorrectly constructed when string is printed before completing the command (my use case was that background tasks print outputs while I'm typing a command, see #733), but apparently it didn't solve all the issues.
@auneri It would be great if you could propose a fix, I would be happy to test it.
About pdb: the Python console should definitely work well with pdb, but note that there much more powerful visual debuggers (PyCharm, Visual Studio, Eclipse, LiClipse). You can very easily set them up, in any environment and any operating system. You might check them out as well.
The mentioned pull request seems to at least recover the old behavior.
@lassoan Thanks for the offer, it definitely needs testing to ensure I didn't break anything..