Hi,
I try to call a python script with an Applescript.
var script = do shell script "python /Users/meyer/Documents/Projects/WoFOG/Code_Antonio/Loader_tracker.py -p /Users/meyer/Documents/Projects/WoFOG/ExpFolder/3001"
application.executeProgram('osascript',['-e',script ])
While the is working in ScriptEditor in servoy it does nothing. I don’t even get an error and nothing is in the servoy.log.
It seams quite strait forward to me and I have not a clou why it doesn’t work.
I would be grateful for any help.
Hi Irene,
application.executeProgram() doesn’t allow spaces in the argument values. You need to put every argument in the array as it’s own entry.
Also you don’t have to use osascript to execute python. Just point to /usr/bin/python as your program.
So your code can look like this:
application.executeProgram("/usr/bin/python", ["/Users/meyer/Documents/Projects/WoFOG/Code_Antonio/Loader_tracker.py", "-p", "/Users/meyer/Documents/Projects/WoFOG/ExpFolder/3001"])
Hope this helps.
Hi Robert,
Thank you for helping, unfortunately it doesn’t work. I already tried that one as many others but it seems I can’t do the magic.
Just to be sure I tried your code on a simple python app that adds a new folder to a directory, but while it is working thru the terminal it doesn’t work with executeProgram.
application.executeProgram("/usr/bin/python", ["/Users/meyer/Documents/Projects/WoFOG/Code_Antonio/try.py"])
What I don’t understand is that it doesn’t return an error or some other kind of message, it is like that rule doesn’t run. I tried many other ways, like make an .sh and call it, at least it returned a “permission denied” in the log. Now I know that Apple’s integrity check is getting worst by the day, bit I don’t want to disable it.
application.executeProgram() doesn’t allow spaces in the argument values.
Probably I understand it the wrong way, but why is this working? It looks likes a lot of spaces to me ![Surprised :o]()
application.executeProgram(‘osascript’,[‘-e’,‘tell application “Finder” to say “David”’]);