I am using the Run Command tool at the end of a workflow to execute a very simple python script which is fixed. That is, the script doesn't change dynamically. I've finally got it to work, but with much frustration - very 'un-Alteryx' given that I'm used to things being obvious and pain-free 🙂
Question 1 - Why does the Run Command tool oblige us to have something in Write Source [Optional] box? After much frustration and digging around I eventually read that we can just shove %temp%\e.1 in there and be done with it. This seems to have no purpose in this scenario, so what value does it add?
Question 2 - Why do I need to put quotes around my Command Arguments .py, but not the location of the python executable? If I don't include the quotes I get this error: Run Command (3) The external program "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" returned an error code: 2
This is inconsistent and confusing. I'm sure there's a good reason for it, but combined it makes the Run Command painful to use for newbies, or for people who use it rarely (like me!).
Thanks
Solved! Go to Solution.
Hi @jt_edin,
Your post has very valid comments. For many, the Run Command tool holds many mysteries. I noticed that in release 2020.2, an example workflow for the Run Command tool has been added, which might help with the use of it. When you click on the tool in the Developer palette, there's a link to Open Example.
I believe the answer to your first question is addressed in the More Info help text in that Example. So you have to put something in either Write Source or Read Results.
As for question 2, here's my theory: Think of Command Arguments as in the arguments in a DOS command like Copy or Move. These commands have 2 arguments separated by a space, but if argument 1 or argument 2 has spaces in them, you need to tell the Copy or Move command that those spaces are not separators between arguments. To do this, you put each argument in quotes like this:
COPY "C:\Location 1\file1.ext" "C:\Location 2\file2.ext"
So, since your argument has spaces in it, you have to put the whole lot in quotes and tell the Command tool that it's all part of one argument.
Hopefully the working example now included as part of Designer will save many hours of frustration in future.