Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Run Command Tool

AlteryxUserFL
11 - Bolide

Hello All, 

 

I'm trying to get a run command tool to run a python script. 

Unfortunately, I get an error. Has anyone encountered this before? 

 

 

Also, I do not need to output anything, so I just wrote the data to an Alteryx database to get the tool working. That output is not being used for anything. 

 

 

DrewDavis_4-1589301500617.png

 

 

 

DrewDavis_1-1589301327077.png

 

 

7 REPLIES 7
patrick_digan
17 - Castor
17 - Castor

@AlteryxUserFL I would use the working directory parameter to point to the exact directory where that py file is saved (UNC of course). I'll try to digup another post I had about the topic.

 

By the way, what version Alteryx are you running? Perhaps it doesn't fit your usecase, but the python tool now comes with Alteryx and could be easier than running external py files.

 

EDIT: here is the post I was thinking of. I just tried to highlight the various ways to make sure everything is reading and writing to the correct directory. For your issue, make sure that the server 1) has python.exe in the folder you specify 2) whatever account you're server is running as has access to that folder and 3) python.exe, when run from that folder, can find the py file. So on second thought, try fully qualifying your py file with its UNC path so that python knows where to run it from.

AlteryxUserFL
11 - Bolide

I love the python tool, unfortunately that is not an option in this case as the server version does not support the tool. I updated it with the full path, but still get the same error. I have gotten confirmation that the path is correct / access is provisioned. Any other ideas? 

 

DrewDavis_0-1589305202313.png

 

 

patrick_digan
17 - Castor
17 - Castor

hmmm...try moving the path in the command arguments down to the working directory. So your command arguments would just be refreshTableauExtract.py and your working directory would be \\.....Extract Refresh Scripts\

 

Do you have access to the server box that is running your alteryx gallery? You would be able to do more there to debug what's going wrong. Apart from that, I think you would need to write a bat file to try and trap the errors to allow you to better debug. It appears that it can the python.exe, but it's having trouble with the py script. 

patrick_digan
17 - Castor
17 - Castor

@AlteryxUserFL Sorry for the stream of consciousness here, but 1 other thing you can try to rule out some issues is adding regular old input tools and trying to have the alteryx gallery read both the python.exe and your py file. You can read it in as a csv with a delimiter of \0. If that's successful, it should rule out various permissions related issues. Here is an example, you would just change the filepath to your python.exe and py files and see if the server has any errors.

 

patrick_digan_0-1589306756465.png

 

 

AlteryxUserFL
11 - Bolide

I updated as you suggested and received a slightly different error (1 instead of 2). I also did the import test you recommended and both flows worked without error. I can get access to the server, what should I check for?

 

Also, Thank you so much for all the help, I have been using Alteryx for a few years and have used the run command prior to this without issue. Not sure what is causing the errors. 

 

DrewDavis_1-1589308442509.png

 

DrewDavis_2-1589308504595.png

 

 

patrick_digan
17 - Castor
17 - Castor

Progress! So now that we're having an error of 1, I think that means that python is actually running your scrip. So I'm assuming now that it's an issue with the py script. 

 

Since you have access to the server, I think you can better try to replicate what the server is doing. Here is what I would do:

1) Logon to the alteryx server.

2) open a cmd prompt (cmd.exe).

3) type in: pushd "\\server\folder\subfolder" (including quotes) to navigate to wherever your py file is saved. This is replicating the working directory.

4) then type in: "\\server\folder\subfolder\python.exe" "RefreshTableauExtracts.py" (including quotes) with the python pointing to where you have python installed on the server. This should replicate the command and command arguments portion of the alteryx run tool. Hopefully that provides a better error response.

5) Alternatively, you can just go and run python.exe normally and try to run your py script to see if that throws any errors.

 

AlteryxUserFL
11 - Bolide

There were two issues. The first one was the setup of the run command tool which you helped fix in the prior post. Another was an issue in the python code... it could not accesses a specific file when running in the server. Thank you so much for the help in getting this fixed! 

 

 

Labels