-
Notifications
You must be signed in to change notification settings - Fork 113
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
Sometimes the width calculation fail #32
Conversation
When bullet calculate the width of terminal could fail throwing this stacktrace: ``` File ".../bullet/utils.py", line 8, in <module> _, n = os.popen('stty size', 'r').read().split() ValueError: not enough values to unpack (expected 2, got 0)``` Using it we asume the standard console width when it fails
Added a default value
Why not use shutil.get_terminal_size()? |
Is better to use it https://gist.github.com/jtriley/1108174 than shutil PS: shutil.get_terminal_sized == os.terminal_size |
That code looks like it was meant for Python 2. shutil.get_terminal_size() was added in Python 3.3. I haven't looked into how it's implemented, but I get the sense that it's meant to work across platforms. |
Yes, i saw it, shutil is better. I will commit it |
Added shutil in order to have default values
shutil.get_terminal_size() returns |
Right, i didn't see that. |
Removed trivial int casting
You're still taking the wrong value. Should be |
Change the order of arguments. Columns are now the first value
Right thanks i was clueless 😥 |
No worries, it happens to me all the time. |
When bullet calculate the width of terminal could fail throwing this stacktrace: