Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

progress bar moves upwards in screen #798

Open
saj1919 opened this issue Aug 22, 2019 · 10 comments
Open

progress bar moves upwards in screen #798

saj1919 opened this issue Aug 22, 2019 · 10 comments
Assignees
Labels
need-feedback 📢 We need your response (question) p2-bug-warning ⚠ Visual output bad question/docs ‽ Documentation clarification candidate

Comments

@saj1919
Copy link

saj1919 commented Aug 22, 2019

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 :

  1. screen -Rd test_screen
  2. run python script with tqdm for loop
    Thats it.

Screenshot 2019-08-22 at 5 44 17 PM

@casperdcl
Copy link
Sponsor Member

casperdcl commented Aug 23, 2019

duplicate of #336?

Looks like you could fix it with ncols=150 or similar, screen seems to be reporting too many ncols.

@casperdcl casperdcl self-assigned this Aug 23, 2019
@casperdcl casperdcl added p2-bug-warning ⚠ Visual output bad need-feedback 📢 We need your response (question) question/docs ‽ Documentation clarification candidate duplicate 🗐 Seen it before labels Aug 23, 2019
@saj1919
Copy link
Author

saj1919 commented Aug 23, 2019

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.

@casperdcl
Copy link
Sponsor Member

so with ncols=150, the bar doesn't fill the full width of the screen but you still see it moving upwards?

@saj1919
Copy link
Author

saj1919 commented Aug 28, 2019

No different output even after choosing ncols=150 ... it moved upwards still.

@casperdcl casperdcl removed the duplicate 🗐 Seen it before label Aug 28, 2019
@casperdcl
Copy link
Sponsor Member

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

@saj1919
Copy link
Author

saj1919 commented Sep 6, 2019

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.

@casperdcl
Copy link
Sponsor Member

@mostafajahanifar
Copy link

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

@stogiannidis
Copy link

stogiannidis commented Mar 5, 2023

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 😃

@xiezhipeng-git
Copy link

xiezhipeng-git commented Mar 30, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-feedback 📢 We need your response (question) p2-bug-warning ⚠ Visual output bad question/docs ‽ Documentation clarification candidate
Projects
None yet
Development

No branches or pull requests

5 participants