rsalmei / alive-progress

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

Alive bar in some IDE does not stay on one line #176

Closed thatrandomperson5 closed 2 years ago

thatrandomperson5 commented 2 years ago

It goes like this instead: |█████████████████████████████████████▋ | █▆▄ 940/1000 [94%] in|█████████████████████████████████████▊ | ▇▅▃ 944/1000 [94%] in|██████████████████████████████████████ | ▆▄▂ 949/1000 [95%] in|██████████████████████████████████████▏ | ▅▃▁ 954/1000 [95%] in|██████████████████████████████████████▍ | ▄▂▂ 958/1000 [96%] in|██████████████████████████████████████▌ | ▃▁▃ 963/1000 [96%] in|██████████████████████████████████████▋ | ▂▂▄ 967/1000 [97%] in|██████████████████████████████████████▉ | ▁▃▅ 972/1000 [97%] in|███████████████████████████████████████ | ▂▄▆ 976/1000 [98%] in|███████████████████████████████████████▎| ▃▅▇ 981/1000 [98%] in|███████████████████████████████████████▌| ▄▆█ 986/1000 [99%] in|███████████████████████████████████████▋| ▅▇▇ 990/1000 [99%] in|███████████████████████████████████████▊| ▆█▆ 995/1000 [100%] i|████████████████████████████████████████| 1000/1000 [100%] in 10.4s (95.91/s)

rsalmei commented 2 years ago

How did you call alive_bar? How many columns does your terminal have? Which OS are you running on? Which Python version are you using?

thatrandomperson5 commented 2 years ago

Python 3.8.12

with alive_bar(len(r)) as bar:

NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION ID="20_04"
HOME URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubunt
u/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal
/terms-and-policies/privacy-policy"
VERSION CODENAME=focal
UBUNTU CODENAME=focal

48 terminal columns.

TheTechRobo commented 2 years ago

By terminal columns he means how wide your terminal window is. You can find it with print(os.get_terminal_size().columns)

rsalmei commented 2 years ago

Please make a video or animated gif. I still can't make sense of it, Linux boxes have always worked flawlessly, without any configuration.

Ciross commented 2 years ago

Same for me, suddenly my alive bar progress started doing this. It does the same using the example code for the alphabet in the readme.

(I'm on Windows11, Python 3.10)

And to complete his issue request, I get this problem only when I use dual line.

rsalmei commented 2 years ago

Hey @Ciross, please open another issue. Windows is another beast, not related to this Ubuntu one.

thatrandomperson5 commented 2 years ago

Please make a video or animated gif. I still can't make sense of it, Linux boxes have always worked flawlessly, without any configuration.

Note that it’s the IDE’s console that is not working. Not bash

rsalmei commented 2 years ago

Ohhh, this makes all the difference in the world........ This should be clear right on the first post. To make the animations, I use special codes called ANSI Escape Codes, which make the cursor do special things. Inside an IDE, they do not need to support those chars, or they support only a subset of them, thus I simply can't do anything about it.

Well, if this IDE is Pycharm, please look for other similar tickets, like #173, because in it alive-progress does work, and is awesome, very fluid. If it is some other IDE, look for some option to emulate a terminal.

I'm going to close this, but feel free to continue if you need.

sortedcord commented 2 years ago

Same for me, suddenly my alive bar progress started doing this. It does the same using the example code for the alphabet in the readme.

(I'm on Windows11, Python 3.10)

And to complete his issue request, I get this problem only when I use dual line.

Really sorry to piggyback this but was this specifically resolved? I'm using vscode and it does emulate the terminal. Alive bar doesn't stay on one line whenever I set dual_line to True...

webpay

rsalmei commented 2 years ago

Hey @sortedcord, it's ok, don't worry. Well, there wasn't anything wrong, so there wasn't anything to resolve.

Thanks for the animated image! We can clearly see the problem in your case... Look at the end of each line, there's Left Arrow, bracket, K. And below it, we have Left Arrow, bracket, One, A. These show that the terminal is NOT handling these commands correctly, they should not be printed, they should be acted upon! For example, the 1A is commanding the terminal to make the cursor go UP one line. That's why it is not overwriting the previous line.

Nothing I can do, if the IDE terminal is not responding to the commands.

PS.: do look further in the config options, I'm certain it does work on vscode (at least on macOS, where I tested it).

Schobs commented 1 year ago

Did anyone solve the multiple line printing issue? I'm using VSCode on Fedora, Linux. Thank you.

rsalmei commented 1 year ago

In Pycharm you have to manually enable Emulate terminal, but on vscode I'm not sure. Please show your code and send a screenshot.