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

John Jackson jjackson at pobox.com
Wed Mar 12 16:19:29 PDT 2008


As usual, Robin nailed it. :)

The command below works from the command line, which suggested that  
Robin's hunch was correct.

In the process demo, I modified the command line to run

python -c "import sys; sys.stdout.write('%s\n%s' % (sys.version,  
sys.path))"

When I run it, I see that I'm running 2.3.5, instead of 2.5.1:

2.3.5 (#1, Mar 20 2005, 20:38:20)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1809)]

...and all the elements in the sys.path are from 2.3. So, of course  
that won't work. That's why Django dies immediately.

(Now, if I flip over to windows, and make the same change in the demo  
there, it says that it is running with 2.5...)

2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]
['', 'C:\\WINDOWS\\system32\\python25.zip', 'C:\\Python25\\DLLs', 'C:\ 
\Python25\\lib', 'C:\\Python25\\lib\\plat-win', 'C:\\Python25\\lib\ 
\lib-tk', 'C:\\Python25', 'C:\\Python25\\lib\\site-packages', 'C:\ 
\Python25\\lib\\site-packages\\PIL', 'C:\\Python25\\lib\\site-packages 
\\wx-2.8-msw-ansi']

On the Mac command line, "which python" returns

/Library/Frameworks/Python.framework/Versions/Current/bin/python

which returns version 2.5.

So, that's the problem. What's the fix?

On Mar 12, 2008, at 2:46 PM, Robin Dunn wrote:

> John Jackson wrote:
>> I've been trying to use wx.Process to launch a Django from a  
>> wxPython application with no luck.
>> What I see in my log are messages such as
>> 11:36:46: Starting server with command:
>> /Library/Frameworks/Python.framework/Versions/Current/bin/python ~/ 
>> Source/Mine/DjangoTest/mysite/manage.py runserver
>> 11:36:46: Debug: wxMacExecute Bad bundle: /Library/Frameworks/ 
>> Python.framework/Versions/Current/bin/python
>> 11:36:46: Debug: pid=22933
>> 11:36:46: Debug: Successfully added notification to the runloop
>> 11:36:46: DjangoStarter: serverPID "22933" started.
>> 11:36:46: Debug: Process ended
>> I'm also sometimes seeing GetOutputStream() returning a stream,  
>> and sometimes not, even when Exists() is False.
>> Googling "wxMacExecute Bad bundle" returns some hits, but nothing  
>> that helped. There was a request by Robin for a sample,  
>> application, but none seemed to be offered.
>
> You can ignore the bad bundle message.  It just means that wxMac  
> discovered that the command you passed is not an application bundle  
> so it will try to run it the old fashioned way.
>
> The real problem seems to be that your Django app is exiting right  
> away instead of sticking around to handle requests.  What happens  
> if you run the same command from a Terminal window?  If it works  
> then do you have any PYTHONPATH set in the environment that is  
> allowing it to work there that would cause it to fail if that is  
> not set in the environment Python gets when run from the wx app?
>
> -- 
> Robin Dunn
> Software Craftsman
> http://wxPython.org  Java give you jitters?  Relax with wxPython!
>
>


______________
John Jackson





More information about the wxpython-mac mailing list