-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
Bar gets cut off after 80 characters #63
Comments
Hey, this seems like the default value of Python's util, when it can't retrieve the number of cols. import shutil
shutil.get_terminal_size() What is the result? |
Could you please paste the code directly on terminal, like I did above? print(''.join(str(x % 10) * 10 for x in range(20))) |
https://gfycat.com/AgreeableThoroughAsiaticlesserfreshwaterclam I removed the time.sleep() call, and after it got to the end it looked like this: (sorry for being slow to respond, I'm turning on email notifications for github so I should respond faster now) |
No problem! Well, that print did print ok, so there isn't anything blocking that. Do you have the WSL? Windows Subsystem for Linux? |
I've tried to get vscode working on wsl, but whatever I do, running |
this also happened to me while using cmd and powershell in windows terminal to run python script:
|
It does seem to be. I'll try to recreate it on a minimal vm, and either find a way to send it to you or lay out the steps tonight when I get back to the hotel. |
It's very strange, I really can't understand why. Thanks @thecakeisalie25, it would be awesome! |
I don't know any docker, I was just gonna make a vmware/virtualbox appliance and send it over via firefox send or magic-wormhole, and you could experiment with it that way. |
Ok, I can try here, no problem. |
Issue is replicated in a minimal windows vm running python 3.9.1, it happens in cmd, powershell, and the vscode terminal. I'm uploading the OVA now, if you're using virtualbox you'll have to change the os to a 64 bit one. |
https://mega.nz/file/1rwXyCLJ#RueKLGr7A80Q8eM5xXc-Hw0CJ2gCrPpsySnYANqaseU @rsalmei here's the link to the ova, import it and check the bar_test file on the desktop. |
That's great, thank you @thecakeisalie25 !
What do you mean? |
Looking through the code, it seems like you wanted to use shutil.get_terminal_size(), but haven't implemented it yet (as per this comment) Loading the core/utils.py file and calling terminal_columns() returns 80: |
and if you still want to test on that virtual machine, you have to edit the machine settings, and in that window there's a setting for virtual OS that you need to change to windows 10 64 bit, it defaults to other/unknown which is 32 bit. |
Oops, you're right, thank you! That explains it. That code for Python 2 uses internals of the console terminal, and really does not work on windows, only unix variants like linux and macOS... As soon as I drop Py2 support it will work as intended..... Thank you @thecakeisalie25, you nailed it. |
Hey, I just realized I can use that code as a fallback, I'm gonna fix it. |
Hey @thecakeisalie25, great news!! |
confirmed fixed, nice work! |
Great!! Thank you man! |
are multiple simultaneous progress bars a planned feature for 2.0? That (and color) are the main features I've been wanting for a while now. I love this library btw, recently used it in my first ever actual major python project, which I'm really proud of. |
Thanks man! And congrats for your first major project! 🎉 Not yet, 2.0 is dedicated mostly to the spinner Compiler (zero overhead animations!), Python 3 and emoji support (grapheme clusters). About multiple simultaneous bars, it is an old request, I'd love to implement that but I'm not so sure how... |
My workaround for this issue is to remind users of my script to keep their terminal window wide. # To fix the problem of cut-off progress bar messages..
if os.get_terminal_size().columns < 100:
raise AssertionError(
"Your alive progress bars are going to potentially get cut off "
"because your terminal window has fewer than 100 character columns. "
"Please shrink the size of your view or expand the width and try again."
) |
Hi @MichaelCurrie, |
Unfortunately I've just seen that my workaround doesn't fix my problem. No matter how wide the terminal it gets cut off at exactly 80 characters: But if I override alive_progress.alive_bar(total_items, max_cols=os.get_terminal_size().columns) I'm not sure if this is really a bug, more of a caveat emptor to set the max_cols. @rsalmei that's another good option as you say, to just shrink the bar itself using |
It cuts off stuff like the ETA and percentage when the numbers are large enough,
This is the vscode terminal if that makes any difference, but it also happens on fluent terminal.
Is there a way to make it adapt to my terminal width?
code example:
The text was updated successfully, but these errors were encountered: