Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stdout progress bars don't work in Pycharm

Many programs display progress bars by prnting to stdout and then returning to beginnign of line and pronting again. This way they achieve realtime progress bar appearence.

Unfortunately, in many cases this functionality does not work in PyCharm's console.

This is an example on how it shows keras train progress bar:

enter image description here

i.e. each progress bar change goes to separate line.

Is it possible to fix this?

like image 879
Dims Avatar asked Jul 10 '17 13:07

Dims


2 Answers

CrazyCoder's comment is the right way to go.

I just formalize his comment as an answer here.


Step1: Go to Run ---> Edit Configurations

enter image description here

Step2: Check the option: Emulate terminal in output console

enter image description here

Voilà

enter image description here

like image 146
Tay2510 Avatar answered Oct 10 '22 15:10

Tay2510


The only way I managed to get progress bars (I'm using tqdm 4.19.5 for a progress bar, PyCharm Community 2017.3.2 and Anaconda/Python 3.6.3) to work correctly was to uncheck the "Show command line afterwards" option:

enter image description here

enter image description here

enter image description here

The solution posted by Tay2510 (checking the "Emulate terminal in output console" option) didn't work for me.

One downside of my solution is that you lose console access after your script is done running.

like image 38
LmnICE Avatar answered Oct 10 '22 15:10

LmnICE