Skip to content
Sign upLog in
← Back to Community

Bug? Python3 output window doesn't support lines that edit themselves

Profile icon
[deleted]

For example, pip installations, when they show a progress bar, constantly updates itself with the current progress of the download. On repl however, every update prints as a new line. Try this code:

import pip pip.main(['install','tensorflow-gpu'])

...and just watch as repl's output starts to print thousands and thousands of lines as the server downloads the package from PyPI, which usually brings my browser to 100% CPU usage just trying to show all of the lines!

Is this a bug in repl.it?

Answered by timmy_i_chen [earned 5 cycles]
View Answer
Voters
Profile icon
RubenJimenez8
Comments
hotnewtop
Profile icon
timmy_i_chen

Yes, we don't currently support specific sequences that they probably use to move the cursor back to the beginning of the line. However, you can avoid that by installing packages through a requirements.txt file ;)

See our docs here

Profile icon
[deleted]

@timmy_i_chen Thanks, that works!

Profile icon
OwenBradstreet

If you coded the progress bar, you can do it by clearing the screen with either os.system("clear") or replit.clear(), and printing it over and over again. In the case of pip, though, I don't think you can move the cursor anywhere or force it to clear the screen each frame, so no.