[issue35635] asyncio.create_subprocess_exec() only works in main thread

2019-06-02 Thread Andrew Svetlov
Andrew Svetlov added the comment: Fixed by #35621 -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> asyncio.create_subprocess_exec() only works with main event loop ___ Python tracker

[issue35635] asyncio.create_subprocess_exec() only works in main thread

2019-01-07 Thread Stefan Seefeld
Stefan Seefeld added the comment: > The limitation is a consequence of how Linux works. > Unix has no cross-platform API for non-blocking waiting for child process > finish except handling SIGCHILD signal. Why does the `wait()` have to be non-blocking ? We can call it once in response to the

[issue35635] asyncio.create_subprocess_exec() only works in main thread

2019-01-07 Thread Andrew Svetlov
Andrew Svetlov added the comment: The limitation is a consequence of how Linux works. Unix has no cross-platform API for non-blocking waiting for child process finish except handling SIGCHILD signal. On the other hand signal handlers in Python should work in the main thread. Your trick with

[issue35635] asyncio.create_subprocess_exec() only works in main thread

2019-01-07 Thread Stefan Seefeld
Stefan Seefeld added the comment: OK, so while I have been able to work around the issues (by using `quamash` to bridge between `asyncio` and `Qt`), I'd still like to understand the rationale behind the limitation that any subprocess-managing event-loop has to run in the main thread. Is this

[issue35635] asyncio.create_subprocess_exec() only works in main thread

2019-01-04 Thread Stefan Seefeld
Stefan Seefeld added the comment: That's quite an unfortunate limitation ! I'm working on a GUI frontend to a Python tool I wrote using asyncio, and the GUI (Qt-based) itself insists to run its own event loop in the main thread. I'm not sure how to work around this limitation, but I can repo

[issue35635] asyncio.create_subprocess_exec() only works in main thread

2019-01-04 Thread STINNER Victor
STINNER Victor added the comment: By the way, asyncio doc is outdated: "The default asyncio event loop implementation on Windows does not support subprocesses. Subprocesses are available for Windows if a ProactorEventLoop is used. See Subprocess Support on Windows for details." https://docs.p

[issue35635] asyncio.create_subprocess_exec() only works in main thread

2019-01-04 Thread STINNER Victor
STINNER Victor added the comment: > Am I missing something ? Given the complexity of this, I would expect this to > be better documented in the sections explaining how `asyncio.subprocess` and > `threading` interact. The current documentation says: "To handle signals and to execute subproce

[issue35635] asyncio.create_subprocess_exec() only works in main thread

2019-01-01 Thread Stefan Seefeld
New submission from Stefan Seefeld : This is an addendum to issue35621: To be able to call `asyncio.create_subprocess_exec()` from another thread, A separate event loop needs to be created. To make the child watcher aware of this new loop, I have to call `asyncio.get_child_watcher().attach_lo