Menu

Carriage Return is not working properly

2011-03-11
2013-03-15
  • Victor Jabur

    Victor Jabur - 2011-03-11

    Hi,
    I made a progress bar that uses carriage return (\r), on shell linux console, it works. But on pydev, the output is displayed using many lines.

    This is the code:

    import sys
    import time
    for i in range(16):
        sys.stdout.write("  %.2f%%\r" % ("#" * i, " " * (15 - i), i/.15))
        sys.stdout.flush()
        time.sleep(.1)

    When i run this on linux shell, only line is displayed, on pydev, many lines is printed.

    Any solution ?

     
  • Victor Jabur

    Victor Jabur - 2011-03-11

    This is the output on pydev:

      0.00%
      6.67%
      13.33%
      20.00%
      26.67%
      33.33%
      40.00%
      46.67%
      53.33%
      60.00%
      66.67%
      73.33%
      80.00%
      86.67%
      93.33%
      100.00%