[Pythonmac-SIG] pythonw and python with applescript
bob at redivi.com
Tue Dec 13 21:56:45 CET 2005
You don't have to change it all to Python, you just need to refactor
it a bit. Instead of embeding Python from C, you embed C from
Python. Of course, it's better to prefer Python code because there
will be less of it, it's not always a good idea to just throw all the
old code away.
On Dec 13, 2005, at 12:46 PM, Zhi Peng wrote:
> 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 .
> 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.
> Yahoo! Shopping
> Find Great Deals on Holiday Gifts at Yahoo! Shopping
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pythonmac-SIG