Hey everyone. So I'm more or less new to Python, just wanted to say that right up front so please excuse any silly questions.<br><br>Generally what I'm trying to do is control a Mac OS X application through a website via Python and appscript. I have successfully got Apache running and configured to run Python scripts, basic modules like os and cgi work and I can do silly form processing and stuff like that, so I know Python itself is good to go, along with the web server. I can execute AppleScript commands, and control applications, successfully using appscript when using Python via Terminal (and following along with the examples), but when I try to import appscript into the script run as cgi I get an 500 Internal Server Error. I know it's the import call because I can comment it out and the script runs, but I can't do any AppleScripting (obviously).
<br><br>Is there a limitation to running appscript when in cgi on Apache? Is there an Apache setting I'm missing? Everything is local, by the way, running off the machine I'm writing this message on. Below is the code that Apache runs:
<br><br>#!/usr/bin/python<br><br>import cgi<br>from appscript import *<br><br>print "Content-Type: text/html\n\n"<br><br># Define function to generate HTML form.<br>def generate_form():<br>    print "<HTML>\n"
<br>    print "<HEAD>\n"<br>    print "\t<TITLE>Info Form</TITLE>\n"<br>    print "</HEAD>\n"<br>    print "<BODY>\n"<br>    print "\t<FORM METHOD = post ACTION = \"
1.cgi\">\n"<br>    print "\t<INPUT TYPE = hidden NAME = \"action\" VALUE = \"launch\">\n"<br>    print "\t<INPUT TYPE = submit VALUE = \"LAUNCH\">\n"
<br>    print "</BODY>\n"<br>    print "</HTML>\n"<br><br># Define main function.<br>def main():<br>    form = cgi.FieldStorage()<br>    if (form.has_key("action")):<br>             if (form["action"].value == "launch"):
<br>                print "COUNTDOWN!"<br>                texteditGUI = app('System Events').processes['TextEdit']<br>                app('TextEdit').activate()<br>                mref = 
texteditGUI.menu_bars[1].menus<br>                mref['File'].menu_items['New'].click()<br>                mref['Edit'].menu_items['Paste'].click()<br>                mref['Window'].menu_items['Zoom Window'].click()
<br>    else:<br>             generate_form()<br><br># Call main function.<br>main()<br><br><br><br>I tried using both 'from appscript import *' and 'import appscript' and it doesn't make a difference. 'from appscript import *' is the way it successfully works when using the command line interpreter.
<br><br>Thanks for any help on this!<br><br>-Andrés Rojas<br>