input() method "never returns" when debugging with sudo python script
Answered
In order to debug python scripts that require root privileges, I have configured pycharm to use the following script as my project's python interpreter:
python-sudo.sh:
#!/bin/bash
sudo /usr/bin/python3 "$@"
This has worked for me until I upgraded to pycharm 2016.2.3 (pycharm 2016.3.2 is similarly affected). In those versions of pycharm, debugging any script that contains a call to input() will block my script execution indefinitely when the input() call is executed. It looks like my script's stdin isn't being properly connected to the debug console. (Note that only debugging is affected. I can run the script within pycharm with no problems.)
Sample (simple) script:
myVar = 'hello'
myVar = input('Enter new myVar value: ') # input call never returns
print('myVar = {}'.format(myVar))
Please sign in to leave a comment.
Unfortunately, it's a regression, please follow https://youtrack.jetbrains.com/issue/PY-22421 for updates. See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.