Closed j-zeppenfeld closed 2 years ago
Apparently this is already fixed for tty.py, but there is still an instance of os.get_terminal_size in styles/exhibit.py.
Wow, that's really odd... 😕 What does that message say? In English.
For tty.py
, I wouldn't say it was "fixed", I was kinda forced to use it because of some exoteric terminals out there, but it is several times slower than the os
one.
I might dynamically test it for the next version then...
If it does not break and returns something non-zero, I'll use it. Otherwise I'll switch to shutil
one 😓
Oh, another detail, the shutil.get_terminal_size()
is not "working as intended". Actually, it just tests if the terminal has an env var with the size, and if not it protects the call to the os
one within a try/catch, and if that also fails, it just returns a default (80, 24).
Yeah, I realized that too after posting the comment. It doesn't work, but at least it doesn't break things.
The German text simply states "OSError: [WinError 6] The handle is invalid"
What version are you using? I do not use os.get_terminal_size()
for a long time, perhaps your version is outdated.
What version are you using? I do not use os.get_terminal_size() for a long time, perhaps your version is outdated.
They're right: https://github.com/rsalmei/alive-progress/blob/3c5cc00e8b29e1813480292a2f5bb2d6414f2932/alive_progress/styles/exhibit.py#L168
That's in exhibit
only.
The stacktrace you posted first was on terminal/tty.py
, called by core
, which doesn't exist for a long time...
File "C:/msys64/mingw64/lib/python3.9/site-packages/alive_progress/core/progress.py", line 266, in __alive_bar alive_repr() File "C:/msys64/mingw64/lib/python3.9/site-packages/alive_progress/core/progress.py", line 123, in alive_repr run.last_len = print_cells(fragments, term.cols(), run.last_len, _term=term) File "C:/msys64/mingw64/lib/python3.9/site-packages/alive_progress/utils/terminal/tty.py", line 32, in cols return os.get_terminal_size()[0]
They said this:
Apparently this is already fixed for tty.py, but there is still an instance of os.get_terminal_size in styles/exhibit.py.
That implies they updated and solved the problem, but styles/exhibit.py still has the function. At least, I think.
Well, I hope so. But I wanted to understand it better, since that change was a long time ago... Closing this one then.
When running an alive-progress bar in MSys2 Bash, the following error occurs:
Running
os.get_terminal_size()
directly in the python3 console produces the same error.Using
shutil.get_terminal_size()
instead works as intended.