process stream CanRead() segfaults

Brendan Simon Brendan at BrendanSimon.com
Fri Sep 1 20:18:43 PDT 2006


I'm getting lots of segfaults with wxExecute and wxProcess when calling 
stream.CanRead() in OnIdle().

Example:
    cmd = 'ls -l /tmp'
    wxExecute(cmd, self.process)

def OnIdle(self, evt):
    if (self.process is not None):
       stream = self.process.GetInputStream()
       if stream.CanRead():
          text = stream.read()
          print 'text =',text

The above example fragment segfaults always, without any output.  I'm 
sure it is the CanRead method.

Interestingly enough, it works if I use the following cmd, although I 
still think I get a segfault at the end.
    cmd = "bash -c 'for i in $(seq 10) ; do ls -l /tmp ; sleep 1 ; done'"

Any thoughts?
Am I doing something wrong?

BTW, this is wxPython-2.4.3.1 on Debian Stable.  It uses gtk1.

Thanks,
Brendan.





More information about the wxpython-users mailing list