Hi, I'm new to Python and really new to Applescript. Could someone explain while the following script works ok from the command-line but not when run as a CGI? #!/usr/local/bin/python import os print "Content-Type: text/html\n\n" applescript = 'osascript -e \"do shell script \\\"echo This is a shell script\\\" \"' #print applescript the_command = os.popen(applescript) print "Output of 'do shell script'<p/>" for line in the_command.readlines(): print("Line: " + line) print "End of output" When it is run on the command-line the output of the "osascript" command is printed in the for loop ok. When run as a CGI only the print statements right before and right after the for loop print. Does it have something to do with the fact that do shell script starts a new sh process? Is there a way to get something like this to work? In the long run I'm looking to use osascript and do shell script to get itunes track data in my python CGI. I tried using PythonIDE's "Generate OSA Suite..." command on iTunes but I get this: ASKING FOR aete DICTIONARY IN '/Applications/iTunes.app' Launched /Applications/iTunes.app Unpack returned empty value: [] So, that is why I'm not using the Python OSA stuff. Thanks a lot! Nate
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4