Run Command Tool
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
Solved! Go to Solution.
- Labels:
- Error Message
- Run Command
- Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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!
