I'm running PyCharm Community Edition 4.0.4
Does anyone know why the error messages don't display after the console output?
Thanks
C:\Python27\python.exe "F:/Google Drive/code/python_scripts/leetcode/lc_127_word_ladder.py" Traceback (most recent call last): START File "F:/Google Drive/code/python_scripts/leetcode/lc_127_word_ladder.py", line 68, in <module> print sol.ladderLength('talk', 'tail', set) Graph: File "F:/Google Drive/code/python_scripts/leetcode/lc_127_word_ladder.py", line 54, in ladderLength hall ['fall'] for item in graph[node[0]]: fall ['hall'] KeyError: 'talk' End Graph: Visited = {'talk': 0} Node = ['talk', 0] Queue Before = deque([]) Process finished with exit code 1
If you'll notice, print statements such as START
, Graph:
, hall ['fall']
, up to Queue Before = deque([])
all happen within the functioning part of my code. The Error messages should appear after all this.
In the Settings/Preferences dialog ( Ctrl+Alt+S ), select Build, Execution, Deployment | Console | Python Console. Select any available interpreter from the Python interpreter list.
The main reason for using the Python console within PyCharm is to benefit from the main IDE features, such as code completion, code analysis, and quick fixes. and check the Special Variables list. The console is available for all types of Python interpreters and virtual environments, both local and remote.
To set window mode for the tool window, right-click the tool window tab and select View Mode | Window. Create a new tab for a data source sessions and output results. Stay on the output pane of the selected query console in the Services tool window.
This is caused by PyCharm mixing print statements from stdout and stderr. There's a fix if you add the following line to your idea.properties
file:
output.reader.blocking.mode=true
Get to idea.properties
via Help | Edit Custom Properties.
might just be an issue with the stdout.
a workaround would be to use sys.flush.stdout() after your print statements.
import sys do_something() print("Your print statement") sys.stdout.flush()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With