[wxPython-mac] Problems with wx.Process & wx.Execute

John Jackson jjackson at pobox.com
Mon Mar 31 11:21:10 PDT 2008


Well, I've finally figured out what the problem is here.

Django uses the thread and threading modules to start the server in a  
different thread. (This can be turned off by using the --noreload  
option when starting Django.)

Turning this off causes the initial output to show up in the window.  
(Whew!) However, then you lose the auto-reload ability of Django,  
which reloads itself when you make changes in the code.

I don't know enough about how a command line window actually works to  
understand why the command line gets the sys.stdout and sys.stderr  
from the different threads (without blocking or requiring changes to  
the child process), but I haven't been able to reproduce the same  
behavior with wxPython.

The thread(s) modules seem to be opaque on how this might happen.

On Mar 17, 2008, at 8:25 PM, John Jackson wrote:
> I've been doing that, thinking in advance that that might be a  
> problem. But it makes no difference.
>
> On Mar 17, 2008, at 5:56 PM, Robin Dunn wrote:
>
>> John Jackson wrote:
>>> I've fixed #2 -- my error, I wasn't passing the panel looking for  
>>> the event correctly to the wx.Process call.
>>> But #1 is curious. It appears that if I add some code that ties  
>>> my code up for a bit, then it gets the error stream. But  
>>> otherwise it misses it.
>>> Even though it gets called in the idle loop.
>>> I notice if I let my script sit around long enough (6 minutes!)  
>>> the original standard out shows up -- long after the standard  
>>> error show up.
>>> Django works by you starting a script called mange.py, which  
>>> imports management.py and runs a method from it. management.py  
>>> prints to standard out.
>>> For some reason, the standard out from the second script  
>>> (management.py) takes about 5 minutes to show up.
>>> Run from the command line, the standard out shows up immediately.
>>> On Mar 14, 2008, at 10:13 PM, John Jackson wrote:
>>>> I've gotten further -- I can start and stop the server --, but  
>>>> am still having a problem with
>>>> 1. the initial output from the process getting lost (at one I  
>>>> _was_ getting it, but not anymore!)
>>>> 2. wx.EVT_END_PROCESS never happening and associated method  
>>>> never being called.
>>
>> Try using the -u flag on the Python you are executing, that puts  
>> it in unbuffered mode.
>
>
> ______________
> John Jackson
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-mac-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-mac-help at lists.wxwidgets.org
>


______________
John Jackson



More information about the wxpython-mac mailing list