running python script with system arguments from applescript
Hi,
I am trying to run a python code from within applescript. A string should be passed as an argument to the python script, i.e. from the terminal, I would do the following
cd /Users/thatsme/Library/Scripts/myfolder
python my_python_file.py abcdefg
There are two ways I figure I could do this in applescript. "abcdefg" are contained in the variable strNote
a) directly:
do shell script "cd /Users/thatsme/Library/Scripts/myfolder; python my_python_file.py " & strNote
b) calling Terminal
tell application "Terminal"
activate
do script "cd /Users/claushaslauer/Library/Scripts/OO_latex; python my_python_file.py " & strNote
end tell
I would prefer option a) as I don't really want to have Terminal windows popping up. The strange thing is, that I see in the applescript results window the result of the print statements in the python script, but no output is generated (the python script contains a few os.system() commands.
Option b) does what it is supposed to be doing, however, applescript does not wait until the script is finished running.
Why does option a) nor work, and what do I need to change to make it work?