Dealing with errors in interactive subprocess running python interpreter that freeze the process

Oscar Benjamin oscar.j.benjamin at gmail.com
Fri Aug 3 10:03:22 EDT 2018


On 2 August 2018 at 20:54,  <cseberino at gmail.com> wrote:
>
>> As others have mentioned, separate threads for the individual pipes
>> may help, or if you need to go that far there are specialised
>> libraries, I believe (pexpect is one, but from what I know it's fairly
>> Unix-specific, so I'm not very familiar with it).
>
> I'm on Linux so pexpect is a possibility.
>
>> Sorry, but there's no "simple" answer here for you (although you may
>> well be able to get something that works well enough for your specific
>> needs - but it's not obvious from your snippet of code what you're
>> trying to achieve).
>
> To send and receive text from a subprocess..even when there are exceptions.

You can do this without threads on Linux using select (or similar):
https://docs.python.org/3.7/library/select.html#select.select

--
Oscar



More information about the Python-list mailing list