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

Difference UI from presented here #145

Closed
pingshunhuangalex opened this issue Apr 12, 2016 · 11 comments
Closed

Difference UI from presented here #145

pingshunhuangalex opened this issue Apr 12, 2016 · 11 comments

Comments

@pingshunhuangalex
Copy link

I just got the latest version of tqdm, but instead of a nice bar UI as presented in the homepage here, it just gives me ####### as progress bar. Is there a way to fix it? Thanks.

@casperdcl
Copy link
Sponsor Member

You'll need an environment which supports Unicode. This is the default for UNIX, but you should see http://stackoverflow.com/questions/388490/unicode-characters-in-windows-command-line-how for windows.

@pingshunhuangalex
Copy link
Author

Thanks for the reply. Could you please elaborate a bit more on how I can apply cp65001 to the console? I'm using cmder running ipython. Many comments also mentioned changing console encoding to cp65001 can potentially break many things, so this may not be the right way to do it, and I can't guarantee other people's computer all have console running @cp65001

Also, is there a reason why you choose to use "#" when encoding is ascii? I went back to your code and change "#" to "█" and it works like a charm. Is there a way why this should not be done? Thanks.

@casperdcl
Copy link
Sponsor Member

I tend to make do with ascii in windows consoles - let us know if you find a better solution.

Nor sure about the character you suggest. It's in the extended ascii table rather than the normal one (0-127) so may produce errors in certain non-unicode environments https://social.msdn.microsoft.com/Forums/en-US/home?sort=relevancedesc&brandIgnore=True&searchTerm=extended+ascii

@nabijaczleweli
Copy link

Windows cmd is Unicode by default in 10 (and probably 8 as well)

@casperdcl
Copy link
Sponsor Member

Does tqdm produce unicode output correctly in win 10?

@nabijaczleweli
Copy link

No, it doesn't
SS

@casperdcl
Copy link
Sponsor Member

Wow that is unexpected. Support for unicode but wrong handling of CR. Come on windows... May have to release a patch for this

@pingshunhuangalex
Copy link
Author

I'm also using win10 64-bit, but the OEM encoding is not Unicode because in windows language settings I set it to some other language if no unicode is found (the default language is still English though), due to the multi-language environment I'm working in.

Anyway, just for the purpose of testing, I set my cmd to 65001 (Unicode), set the font to Lucida Console and run the test again. No, it just doesn't work, not to mention it breaks some of my .bat file containing foreign characters. So, I'm just gonna stick to "█" solution.

1

Also, just some quick feedback here (you don't have to change) cuz I don't want to open new issues:

  1. When I use bar_format to customise the display, the ncols option just breaks. Not surprising because you only calculate len({l_bar}{bar}{r_bar}) in your code, there's no adjustment for bar_format
  2. print anything within the loop will break tqdm and show things all over the place
  3. I try to add a new line/print something between progress bars, but it's really painful when it comes to nested bars.
  4. The position option will be overwritten by the print code I wrote after the progress bar
  5. Print anything within the loop just breaks everything
  6. Using\n in "desc" just breaks everything
  7. It seems that the tool can only show 1 bar for every level of the hierarchy, e.g.
for i in A:
    for j in B:
        sleep(0.01)

Imaging A is a collection of spreadsheets in a folder, and B is all the rows used in one spreadsheet. Previously, I was expecting to see 1 progress bar for A (Total, showing how many files are processed), and to see a bar for every finished spreadsheet, i.e. every loop in B. But instead, the bars in B loop will just overwrite itself due to the nature of the code.

Maybe I didn't use the tqdm properly, but hope my feedback is helpful to you making tqdm a better tool. Thanks.

@lrq3000
Copy link
Member

lrq3000 commented Apr 25, 2016

Please try to install colorama library, I initially added the support of colorama in tqdm to support nested progress bars, but it can also help with unicode handling. This should also fix your 6th point @pingshunhuangalex.

About IPython, there will be soon a tqdm_notebook module specifically dedicated to IPython/Jupyter support, see #92.

About 1th and 4th @pingshunhuangalex, this will be fixed with the new method tqdm.write() in #150.

About 5th, this is normal, you should not add any line return character nor any other cursor positionning character, because it will break tqdm position handling (remember tqdm is not using curses, so there's no way for tqdm to absolutely position itself, it must rely on a relative positioning scheme that simulate an absolute positioning scheme as long as you don't interfere).

@lrq3000
Copy link
Member

lrq3000 commented Apr 25, 2016

About the first 1th point about improper bar ncols formatting with custom bar formatting, this should be fixed with proposition #149 hopefully, thank's to @karanlyons.

@lrq3000
Copy link
Member

lrq3000 commented May 15, 2016

Most points are fixed by PRs #149 and #150. About display breaking in Win10, I expect that the latest release of colorama should already fix these issues. I'm closing this issue now, but if the issue still happens, feel free to post here or open a new issue.

@lrq3000 lrq3000 closed this as completed May 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants