Jump to content

[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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...