[Pythonmac-SIG] pythonw stay open
hengist.podd at virgin.net
Wed Dec 7 11:50:18 CET 2005
Ryan Wilcox wrote:
>I have a bunch of CGIs that make use of pythonw (+cgiwrap) to allow me
>to send AppleEvents (via appscript) to applications on the web server
CGI's always going to be expensive as it starts a new process for each request. And yeah, if it's a GUI process then the overheads will bite even more.
I imagine there's various options open to you, e.g. ditch CGI for something a bit more advanced, or put the AE stuff into a faceless GUI process that runs in the background and have your CGI scripts communicate with that via some other form of IPC. Not my area of expertise, so can't advise further, but you should look into it.
Another possibility might be to do AEs over mach: I got sent some proof-of-concept code for this a while back and stuck it in the CarbonX.AE extension; assuming you've the latest versions installed it's a one-line tweak in aem.send.send to use it. Usual caveats apply: unofficial, undocumented, untested; subject to bugs, changes, removal; etc, etc.
Also, if you're using appscript then make sure you run the terminology server to reduce the time it takes each process to obtain terminology data, or switch to using aem (tip: appscript.aemcodegen makes translating existing appscript code to aem code fairly easy).
More information about the Pythonmac-SIG