Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path:
Thank you so much Jerry.I should have read though the man page more carefully. The avai= lable online cscope tutorials never mentioned the line-oriented mode.
On Fri, Jan 3, 2014 at 9:44 PM, Beinan Li <li.beinan@gmail.com> wrote:Right. =A0communicate() waits for the subprocess to end, and the
> But some console programs have their own shell or ncurse-like CUI, suc= h as
> cscope.
> So I figured that I need to first subprocess.popen a bidirectional pip= e and
> send command through stdin and get results from stdout and stderr.
>
> But in such a case I found that communicate('cmd') will freeze= .
subprocess is still waiting for you to do something. =A0Instead, you'll=
need to read() and write() to the subprocess' stdin and stdout
attributes, probably something like this (untested):
=A0 =A0 self.subProc.stdin.write('symbolName\n')
def OnClickBtn(self, event):
=A0 =A0 print('OnClickBtn')
=A0 =A0 print(self.subProc.stdout.read())
It looks like cscope has both a screen-oriented mode and a line-based
mode. =A0When you're working with a subprocess like this, you're go= ing
to want to be in the line-based mode, so you'll probably want to add
-l or -L to your command line.
--
Jerry