[Pythonmac-SIG] pythonw and python with applescript

Zhi Peng zhiyong_peng2003 at yahoo.com
Tue Dec 13 21:46:08 CET 2005


Hi! Bob 
   
  What you suggested is right. 
   
  The interesting thing is that I have a lot of old c code which will try to call python code. It is true that I can write pure python code and use py2app (I use py2exe on windows) to make an executable. That  will make life easy. But .. 
   
  I think that I need to do something as you said, try to change all C code to python, it may be easier than that I embeded python to C. 
   
  Thanks all .
   
  Zhi 
   
  

Bob Ippolito <bob at redivi.com> wrote:
  
On Dec 13, 2005, at 12:18 PM, Zhi Peng wrote:

> If we use pythonw, then there may be problem in C code to call the 
> python code with appscript inside because it seems 
> PyImport_ImportModule("ModuleName") only works with python instead 
> of pythonw.

pythonw is just a shell script. You're embedding Python, it's not 
even an option. You must use an application bundle in order to 
communicate with WindowServer.

You probably shouldn't be embedding Python in the first place.. Much 
easier that way, because py2app can create the application bundle for 
you, and you don't have to deal with all of the initialization/ 
finalization for Python.

-bob


  


			
---------------------------------
Yahoo! Shopping
 Find Great Deals on Holiday Gifts at Yahoo! Shopping 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051213/144517dd/attachment.html


More information about the Pythonmac-SIG mailing list