rsalmei / alive-progress

A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
MIT License
5.45k stars 205 forks source link

Jupyter ignores dual_line mode; Pycharm must enable "Emulate terminal" #185

Closed alllexx88 closed 2 years ago

alllexx88 commented 2 years ago

First of all, thanks a lot for alive-progress! I find it cool and very useful. I've noticed an issue in environments that require force_tty=True when dual_line=True is enabled, like in Jupyter notebooks or in PyCharm without enabling terminal emulation: the progress bar gets printed as new lines instead of being updated; see screenshot below.

Screenshot_20220824_122824

While it is easy to work around in PyCharm, that is not the case with Jupyter notebooks.

Thanks :smiley:

TheTechRobo commented 2 years ago

The PyCharm issue is a duplicate of #173, for what it's worth.

alllexx88 commented 2 years ago

Yes, there's a workaround you can use in PyCharm (which I also mentioned above), but not in all other cases that require force_tty=True, say, in Jupyter notebooks: Screenshot_20220828_171708 And it works okay without dual_line=True Screenshot_20220828_171934

rsalmei commented 2 years ago

Hi @alllexx88, thank you.

I've already told here, a lot of times actually, that Jupyter does not support ANSI Escape Codes. This means it simply ignores the command to make the cursor go up and refresh the previous line, thus it is impossible to make dual line work on it.

Actually, it even ignores the most basic commands, like the one to clear the current line! I had to print several spaces at the end of the line to work around that and clear the garbage from the last line... The same can be said about Pycharm without terminal emulation. These needed commands are ignored if this option is not enabled, so it doesn't even make sense to try to run it there like this. I don't even understand why would Jetbrains require an option to make the terminal actually work, it seems silly to me.

That's it, I expect it should be pretty clear by now that these fancier modes require a terminal. It simply can't be done if the environment summarily ignores the needed cursor commands.

alllexx88 commented 2 years ago

@rsalmei , thanks a lot for your explanation and your great efforts to keep alive-progress going. Have a great week!

rsalmei commented 2 years ago

Thank you @alllexx88, have a good one too! 👋