How to pause script execution in PyCharm Community?

微笑、不失礼 提交于 2020-12-12 11:03:50

问题


I wrote this piece of code and tried to debug it:

from time import *

for i in range (100):
    sleep(1)
    print(i)

I first run this script in debug mode, and try to pause it by clicking the pause button, but the pause button doesn't work at all, it just keep printing new numbers.

Then I directly run this script (not in the debug mode), the pause did stop pycharm from printing new numbers, but the script is actually still running in the background, when I resume the script, it prints a lot of numbers all of a sudden.

So how can I correctly pause the script execution?

I installed pycharm and python in a whole new windows 7, it still behaves like this.

The stop and rerun button works perfectly, breakpoints too. But the pause button never works.


回答1:


The pause ("Pause Output") button only temporarily suspends output to the terminal - it has no effect on the script execution. You may wish to use debug mode with breakpoints instead.

You can add breakpoints into your program by clicking in the space to the left of the text editor (the "Left Gutter", where line numbers appear, if you have them enabled).

See the Pycharm documentation for more information.



来源:https://stackoverflow.com/questions/44804773/how-to-pause-script-execution-in-pycharm-community

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!