I'm trying to make AppleScript to execute Python 3 script:
on run {input, parameters}
tell application "Terminal"
do shell script "/usr/local/bin/python3 /Users/UserName/Desktop/PyHello.py $@"
end tell
return input
end run
but I'm still getting an error 1721. I tried different types of file as well as changing Command Line command from:
/usr/local/bin/python3 /Users/UserName/Desktop/PyHello.py $@
to
/python3 /Users/UserName/Desktop/PyHello.py $@"
Both commands:
/usr/local/bin/python3 /Users/UserName/Desktop/PyHello.py $@
and
/python3 /Users/UserName/Desktop/PyHello.py $@"
Run OK, when typed directly within the Terminal.
tell
anything to rundo shell script
you just do it.do shell script
is an AppleScript built-in and runs in the context oftell current application
and is only explicitly needed whendo shell script
is set within another applicationstell
block to avoid throwing an error. That said, it's usually a non-fatal error and AppleScript then executes it in atell current application
block. Terminal has ado script
command. Maybe the OP is confused on which to be using, however I can't say why for sure because the OP is lacking some details.on run {input, parameters}
handler. Are you doing this in Automator or Script Editor? If the latter, that's why you are getting the error. Anon run {input, parameters}
handler doesn't run within Script Editor.error "" number -1721
?on run {input, parameters}
handler. Are you doing this in Automator or Script Editor? and You said "but I'm still getting an error 1721". Is there any message with the error or is it justerror "" number -1721
? Please put the issue in proper context so we can troubleshoot this better. Do not cross post to multiple SE sites.