[wxPython-users] process stream CanRead() segfaults

Robin Dunn robin at alldunn.com
Mon Sep 4 10:46:07 PDT 2006


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!





More information about the wxpython-users mailing list