[Pythonmac-SIG] CGI + appscript newbie question/problem
Hamish Allan
hamish at gmail.com
Mon May 28 11:50:48 CEST 2007
When you run appscript at the command line and the little rocket
appears in the Dock, that's Python connecting to the window server --
through which Apple events are managed. For security purposes, your
Apache process can't connect to the window server. You'll probably
have to create a daemon running as yourself or whoever owns the window
server for communicating with the app, and then use a different
interprocess communication mechanism to interact with that daemon. You
might want, for example, your daemon to monitor a directory using
PyKQueue and open a TextEdit document for the contents of any file
that is created in that directory (you'll need to find out what user
your CGI is running as, for which you can use os.geteuid(), and ensure
that that user has write permissions for the directory in question).
By the way, have you considered looking into one of the web frameworks
for Python? It might seem rather overcomplicated for such a simple web
app, but it could turn out to be easier in the long run (I use Pylons,
your mileage may vary), unless perhaps you have existing pages on your
Apache web site that are all based on traditional CGI.
Best wishes,
Hamish
More information about the Pythonmac-SIG
mailing list