Reputation: 559
Is there any way to see if a command is currently being executed in the PyCharm console?
Running an interactive python session in the terminal, after executing a command, the prompt disappears until execution has finished. For example when I call time.sleep(5)
, it takes 5 seconds until the >>>
appears again, so I know the command is still being executed.
Running an IPython console in PyCharm the prompt never disappears. Only when I start typing again I get a message "Previous command is still running". This way it's hard to see when a command has finished without constantly "probing" the prompt.
Upvotes: 7
Views: 4700
Reputation: 1491
I've found the best way to do when using IPython is to the %time
magic command whenever you need to run a long command. For details, see https://ipython.org/ipython-doc/3/interactive/magics.html#magic-time
Usage:
In[1]: %time time.sleep(5)
Wall time: 5 s
The second line will appear when the code finishes. This also has the added bonus of telling you how long execution took.
Note: Don't accidentally confuse it with the %timeit
command which will run your code several times
Upvotes: 5