Wrapping an interactive CLI in python

前端 未结 1 1072
执笔经年
执笔经年 2020-12-18 03:40

I am trying to wrap gnugo in a python script.

I\'ve gone over the other questions in SO about wrapping CLI applications here and here and though they\'ve helped so

相关标签:
1条回答
  • 2020-12-18 04:09

    Your issue is that Popen.communicate closes the file after performing its reads and writes.

    You will have to manually call proc.stdin.write(...) to send the process text and proc.stdout.read*() to read text:

    while True:
        proc.stdin.write(c)
        r = proc.stdout.readline()
    
    0 讨论(0)
提交回复
热议问题