You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from invoke import task, run
@task
def foo():
print("Hello, world!")
run("echo Hi")
When I try to run it (invoke 0.12.0, Python 3.5.0 64-bit) on Windows 7, I get the following error:
>inv foo
Hello, world!
Hi
Traceback (most recent call last):
File "c:\users\uk03306\appdata\local\programs\python\python35\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\uk03306\appdata\local\programs\python\python35\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\UK03306\AppData\Local\Programs\Python\Python35\Scripts\inv.exe\__main__.py", line 9, in <module>
File "c:\users\uk03306\appdata\local\programs\python\python35\lib\site-packages\invoke\program.py", line 270, in run
self.execute()
File "c:\users\uk03306\appdata\local\programs\python\python35\lib\site-packages\invoke\program.py", line 379, in execute
executor.execute(*self.tasks)
File "c:\users\uk03306\appdata\local\programs\python\python35\lib\site-packages\invoke\executor.py", line 114, in execute
result = call.task(*args, **call.kwargs)
File "c:\users\uk03306\appdata\local\programs\python\python35\lib\site-packages\invoke\tasks.py", line 113, in __call__
result = self.body(*args, **kwargs)
File "C:\Work\Scratch\tasks.py", line 5, in foo
run("echo Hi")
File "c:\users\uk03306\appdata\local\programs\python\python35\lib\site-packages\invoke\__init__.py", line 27, in run
return Context().run(command, **kwargs)
File "c:\users\uk03306\appdata\local\programs\python\python35\lib\site-packages\invoke\context.py", line 53, in run
return runner_class(context=self).run(command, **kwargs)
File "c:\users\uk03306\appdata\local\programs\python\python35\lib\site-packages\invoke\runners.py", line 232, in run
raise ThreadException(exceptions)
invoke.exceptions.ThreadException:
Saw 1 exceptions within threads (OSError):
Thread args: {'kwargs': {'input_': <_io.TextIOWrapper name='<stdin>' mode='r' encoding='cp437'>},
'target': <bound method Runner.handle_stdin of <invoke.runners.Local object at 0x0000000002FDA780>>}
Traceback (most recent call last):
File "c:\users\uk03306\appdata\local\programs\python\python35\lib\site-packages\invoke\runners.py", line 804, in run
super(_IOThread, self).run()
File "c:\users\uk03306\appdata\local\programs\python\python35\lib\threading.py", line 871, in run
self._target(*self._args, **self._kwargs)
File "c:\users\uk03306\appdata\local\programs\python\python35\lib\site-packages\invoke\runners.py", line 411, in handle_stdin
reads, _, _ = select.select([input_], [], [], 0.0)
OSError: [WinError 10093] Either the application has not called WSAStartup, or WSAStartup failed
Note that the task output appears fine, so it's not clear what's going on here. Is it possible that invoke is trying to use select.select on sys.stdin? That's not allowed on Windows, you can only use select on sockets...
The text was updated successfully, but these errors were encountered:
Yes, confirmed. Runner.handle_stdin sets use_select when isatty(input_) is true. That's what triggers trying to use select on a non-socket stream. But simply using False for use_select breaks, as the program hangs waiting for input, and then fails in write_stdin.
pfmoore
changed the title
select/threading error on Windows
Stdin handling for terminals is broken on Windows
Jan 14, 2016
I just created a simple tasks file on Windows:
When I try to run it (invoke 0.12.0, Python 3.5.0 64-bit) on Windows 7, I get the following error:
Note that the task output appears fine, so it's not clear what's going on here. Is it possible that
invoke
is trying to useselect.select
onsys.stdin
? That's not allowed on Windows, you can only useselect
on sockets...The text was updated successfully, but these errors were encountered: