Run a python/pandas script with multiple input/output files
- 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
Can anyone help me build a workflow to run the attached python script with multiple input/output .csv files?
In windows cmd.exe, all I need is to type "python.exe test.py". However, if I use "run command" tool in alteryx, how do I define the "Write Source" and "Read Results" fields for my script?
Plus, what is the best way to define a pseudo in/out flow connected to the "run command" button?
Solved! Go to Solution.
- Labels:
- Run Command
- Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@silvia_wang I'm attaching an example that worked on my end when you save it in the same directory as your test.py. When using the run command tool, you have to setup at least one of the write source and read results. In your case where you're running a static py file, you don't need either for your process to work. Alteryx still requires one. The easiest thing is to connect dummy data to input of the run command (ie write source) and write the data out to a dummy temp file (I've written out the file %TEMP%dummy.yxdb). We don't need to connect anything to the read results. We put python in the command box. We put test.py in the command arguments. it will generally run python from the workflow directory, but you may need to add the workflow directory directory explicitly (like %Engine.WorkflowDirectory%test.py) if you come across errors with it not finding test.py. It ran fine on my end.
In a more complex case, you could have alteryx and python interacting. You could use the write source of the run command tool to write a csv file out that your python does something with. You could then use the read results to read data back into alteryx. The idea is that the write source is a file that your script can use, and then the read results is reading in the output from your script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks for your solution @patrick_digan ! This works perfect for me!
