process stream CanRead() segfaults

Brendan Simon Brendan at BrendanSimon.com
Mon Sep 4 15:47:37 PDT 2006


As mentioned below, the command "bash -c 'for i in $(seq 10) ; do ls -l 
/tmp ; sleep 1 ; done'" seems to work, HOWEVER it DOES segfault at the end.

I'm wondering if it is some kind of string termination problem with 
python strings versus wxString.

The wxpython-demo works, but it uses a wxTextControl to return the 
command, and the returned object is a wxString not a python string.

How do I convert a python string into a wxString?
Does wxString exist in wxPython ???
I shouldn't need to use wxString, right??

BTW, it segfaults on the following systems.
	wxPython-2.6.3.2.1.5 on Debian Testing(Etch) using gtk2.
	wxPython-2.4.3.1 on Debian Stable(Sarge) using gtk1.

Brendan.


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)
> 
> 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