process stream CanRead() segfaults

Brendan Simon wrote:

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)

I assume you meant something like this?

  wxExecute(cmd, wxEXEC_ASYNC, 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.

Did you call self.process.Redirect()?

Did you check the return value of wxExecute?

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!