progress bar moves upwards in screen
When I run for loop with tqdm in terminal ... it works fine.
When I run the same thing in linux screen ... below thing happens.
I think its a bug. Any code with tqdm around for loop can be checked for the replication.
Was able to replicate in Ubuntu and Mac
Steps :
- screen -Rd test_screen
- run python script with tqdm for loop Thats it.
duplicate of #336?
Looks like you could fix it with ncols=150 or similar, screen seems to be reporting too many ncols.
It is not a direct duplicate of #336 as here progress-bar is moving upwards which is worse.
In case you press Enter it comes down as usual and then again keeps going upwards. Hard to keep track of whats running because normal print statements will print as usual over these progress-bar once tqdm is finished.
I tried ncols=150 ... didn't work.
so with ncols=150, the bar doesn't fill the full width of the screen but you still see it moving upwards?
No different output even after choosing ncols=150 ... it moved upwards still.
right. judging by the fact that it works fine in your terminal outside screen, though, I'm hoping it's a bug with screen.
There's no way a single bar should be moving upwards. Nested ones; perhaps.
Can you try:
print('a\nb\rc\nd\re')
the output should be
a
c
e
Hi, sorry for delayed answer. Output ->
a
c
e
Were you able to reproduce this issue on Ubuntu screens ? For me it happens every time. And my use case is to run my code in screen and see the progress. Now I am using nohup instead of screen just to see the progress.
- I use
tmuxwhich seems to work without issue - you may need
screen -U(https://stackoverflow.com/questions/52250556/tqdm-in-screen-environment-printing-new-line-and-unknown-charactors)
When calling tqdm, try to include argument ascii=True in order to deal with screen not being UTF-8 friendly. Something like below:
for item in tqdm(items, total=len(items), ascii=True):
pass
based on this post you need to enable UTF-8 encoding. To do that simply run screen -U , assuming you are using the screen multiplexer
It worked for me at least 😃
I have same problem with windows wsl,And I found,If change shell width large. it is not move.if width small.it is move. because can see two rows info on screen. if change ncols do not work. is it any other function to slove it? @casperdcl @stoyian i found tqdm(desc=self.name,position = self.position) position is important with this problem. if tqdm suport position list. can reslove it. position = [0,1,2] like this or autoposition
duplicate of #336?
Looks like you could fix it with
ncols=150or similar,screenseems to be reporting too manyncols.
This works for me. I set ncols=100 and it works fine.