Jump to content
alfredclough

[SOLVED] Trying to Run a Python Script from AppleScript and Receiving an Error

Recommended Posts

To make a long story short, I updated a workflow. It has a long action that is done by an Alfred Script object in AppleScript. In certain cases, I want to do some of the work via a python script rather than in AppleScript. To do this I added the following which checks a variable already set and if so tries to run a python script I put in the workflow folder. (The argument passed is encapsulated in quotes)

			--check if online and if so, use Python.
			if contents of online is "online" then
				--run script to put passage onto the clipboard
				do shell script "python ./get_verse.py \"" + passageRef + "\""
				--paste the passage into the current app
				keystroke "v" using command down
			else

The réponse I'm getting back in Alfred debugging is: 

[2019-01-16 15:18:30][ERROR: action.script] /Users/samuel/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Scripts/27C48708-2D1A-4008-BCBF-CCABCD6247DC:801:811: execution error: Can’t make "python ./get_verse.py \"" into type number. (-1700)

This tells me it's not executing the python script. I'm sure there's something simple here I'm missing but cannot figure out what it is.

Share this post


Link to post

Replace the + with & 

 

AS is trying to add numbers ( hence the error message ) rather than concatenating strings.

Edited by dfay

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×