OSError: [WinError 6] The handle is invalid with pytest or tox
See original GitHub issueWhen running in pytest or tox got this error
def alive_repr(spin=''):
update_data()
line = '{} {}{}{} in {} {} {}'.format(
bar_repr(run.percent, end), spin, spin and ' ' or '',
monitor(), to_elapsed(), run.stats(), run.text or title or ''
)
line_len = len(line)
with print_lock:
if line_len < run.last_line_len:
clear_traces()
> sys.__stdout__.write(line + (spin and '\r' or '\n'))
E OSError: [WinError 6] Das Handle ist ungültig
but progress bar is done
here with tox:
test code:
from alive_progress import alive_bar
def test_progress():
items = range(1000) # retrieve your set of items
with alive_bar(len(items)) as bar: # declare your expected total
for item in items: # iterate as usual
# process each item
bar() # call after consuming one item
if __name__ == "__main__":
test_progress()
tox
[tox]
skip_missing_interpreters = True
ignore_basepython_conflict = true
envlist =
py{36, 37, 38},
[testenv]
setenv =
PYTHONUNBUFFERED=yes
skip_install = true
deps =
pytest
alive-progress
commands =
pytest {posargs}
calling it directly make no problems
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
OSError: [WinError 6] The handle is invalid - Stack Overflow
A similar error is common when running via pythonw.exe. Prior to Windows 8, a pythonw.exe process has console handle values in its standard ......
Read more >Occasional "invalid handle" error on Windows when ... - GitHub
Issue: I have written a short tool, that executes pytest programatically with an added (trivial) plugin. The idea was to be able to...
Read more >Invalid handle error from Coverage inside Tox - Sam Hooke
My tox py36 task was failing with a The handle is invalid error, ... %s\n" % msg) INTERNALERROR> OSError: [WinError 6] The handle...
Read more >OSError: [WinError 6] The handle is invalid, what is it? - Reddit
Trying to run a project from github and I got this error.
Read more >SetupApi.h in Python throwing OSError: [WinError 6] The ...
When it get there it throws OSError: [WinError 6] The handle is invalid. Any thoughts? import ctypes, ctypes.wintypes; win = ctypes.wintypes ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah man, unfortunately it is…
Well, I’ve found this answer that could help: https://stackoverflow.com/a/27093194
Also this readme explains a lot: https://github.com/Drekin/win-unicode-console See: The standard stream objects (sys.stdin, sys.stdout, sys.stderr) are not capable of reading and displaying Unicode characters in Windows console.
Anyway, do you really need WindowsOS support? Actually I didn’t even know
alive-progress
didn’t work on it, as no one had ever complained about it. So it would be pretty low on my priority to try to support it…Hey, I just found out that Windows Terminal does support Unicode. give it a try!
I’ve installed Python on a Windows machine, and ended up stuck with another bug: #50 I’ll close this one for now, feel free to reopen if you have any more information.