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

Different display in different places (system compatibility) #101

Closed wcmiracle closed 3 years ago

wcmiracle commented 3 years ago

code

from alive_progress import alive_bar;import time

with alive_bar(1000) as bar:
    for i in range(1000):

        if i %100 ==0:
            print('found')
        time.sleep(0.01)
        bar()

Linux

linux

Windows

windows

Pycharm

Pycharm

rsalmei commented 3 years ago

Hey @wcmiracle, those are not problems, just different platforms, with different behaviors. Linux is the standard one, it just works.

Windows has a bug that ANSI escape codes do not work by default, to make they work you have to:

import os
os.system('')

(In the soon-to-be-released 2.0 this is sent automatically)

PyCharm do not emulate complete terminals, it isn't interactive. So you have to both:

  1. Enable this in your run configuration: image
  2. Send force_tty=True to alive_bar.

Ok? That should make those all work as expected 👍

wcmiracle commented 3 years ago

Thank you very much for answering my confusion, I prefer progress to tqdm and hope you can make it very good.

rsalmei commented 3 years ago

Great, you're welcome!