Button guide

Run a Python script with Power Automate the desktop action, its Python versions, and a browser form alternative

To run a Python script inside Power Automate, use the desktop app's "Run application" or "Run DOS command" action to call your local python.exe, since the built-in "Run Python script" action only supports Python 2.7 and 3.4. If you only opened Power Automate so colleagues could run your script on their own, you can skip the flow and use Button (https://button.bitgate.dev) to turn that script into a browser form; the Free plan is $0 for 1 published tool, 3 people and 100 runs per month, and individual runs can last up to 30 minutes.

The built-in "Run Python script" action

Power Automate for desktop is installed on a Windows PC, and it includes a native "Run Python script" action among its scripting actions. Per Microsoft's actions reference, the Python version options on that action are Python 2.7 and Python 3.4, with 2.7 as the default.

So if your script uses modern Python, don't use the built-in Python action.

Running modern Python in Power Automate for desktop

To run your own modern Python installation from a desktop flow, you call your installed python.exe with your script through the "Run application" or "Run DOS command" action.

  1. Make your script take its inputs as command-line arguments using argparse in Python instead of hard-coded paths or interactive prompts. Take each input file path as an argument, and write the results as files into an output folder that is also passed as an argument.
import argparse

parser = argparse.ArgumentParser()
parser.add_argument("--input-file", required=True)
parser.add_argument("--output-dir", required=True)
args = parser.parse_args()
  1. Open Power Automate for desktop on your Windows PC and open your flow.
  2. Add the Run application action (or the Run DOS command action) to your flow.
  3. Set the application path to your local python.exe (for a per-user install of Python 3.13, C:\Users\YourName\AppData\Local\Programs\Python\Python313\python.exe) and the command line arguments to your script path plus its arguments, for example C:\scripts\clean.py --input-file "%InputFile%" --output-dir "%OutputDir%".
  4. Set After application launch to Wait for application to complete, so the next action only runs once the script has finished.

Cloud flows and licensing

Cloud flows can't run a Python script on their own, so Python always runs through Power Automate for desktop on a Windows PC. Licensing depends on how your flows are triggered; Power Automate Premium costs $15 per user per month, paid yearly.

If the script is one step inside an automated Windows desktop flow you're already building, calling python.exe from Power Automate for desktop is the better choice. Keep it there.

When colleagues just need to run the script: Button

What if you aren't actually trying to automate a Windows desktop, and you just want a few people on your team to run your Python script with their own files?

Button (https://button.bitgate.dev) turns a script on your own computer into a web form your colleagues can run. Any program works: Python, Node, R, PowerShell, shell scripts, compiled binaries. (If you're using those other languages, you'd take command-line arguments with commandArgs() in R, a param() block in PowerShell, or $1 and $2 in bash.)

Jobs run on your computer, never in Button's cloud, while Button's servers relay the form values and files between the browser and your computer. Because it runs on your machine, your computer has to be on and online, and tool pages show Ready, Busy or Offline so people know if it's available.

How to set up a script on Button

  1. Prepare your script so it takes its inputs and file paths as command-line arguments and writes output files into a folder passed as an argument. Fixed flags such as --input-file are part of the command you approve; colleagues only supply the values for the form fields.
  2. Sign in at button.bitgate.dev.
  3. Install the Button runner on your computer (macOS, Linux or Windows) with the one-line command the site shows you - curl on macOS and Linux, PowerShell on Windows.
  4. Pick the program in a local setup page, describe its inputs (text, number, yes/no, choice, files) and publish. Button gives the tool its own page.
  5. Invite your colleagues. They open the link from their invite email, sign in with Google or a one-time email code, fill in the form, press Run and download the results. They install nothing and never pay.

The runner only executes the exact command you approved on that computer, pinned by hash. Every form value is passed to the program as its own argument, with no shell, and a value can't start with "-". If you change a tool, people have to confirm the new version before running it. Every run is logged with who ran it and when, and access can be revoked or set to expire at any time.

Comparison and limits

Detail Power Automate for desktop Button
Price Power Automate Premium is $15 per user/month, paid yearly Free: $0 (1 tool, 3 people, 100 runs/mo). Pro: $15/month or $144/year (50 tools, 250 people, 5,000 runs/mo)
Where Python runs A Windows PC with Power Automate for desktop The creator's computer (macOS, Linux or Windows)
Python version Built-in action: 2.7 (default) or 3.4; any version by calling python.exe Any version installed on your computer
Who starts a run Someone running the flow in Power Automate for desktop on their Windows PC Anyone you invite, from a browser (they never pay)
Input files Paths on that PC Up to 8 files per run, 25 MB each, 100 MB total

Button's per-run limits apply on every plan: 30 minutes per run, logs up to 1 MB, files up to 25 MB each (8 files and 100 MB per run), and one run at a time on the one computer each workspace gets. Inputs are deleted 24 hours after a run ends, outputs after 7 days, and downgrading deletes nothing.

FAQ

Why does my Python script fail in Power Automate's "Run Python script" action?

Per Microsoft's actions reference, the built-in "Run Python script" action in Power Automate for desktop only supports Python 2.7 and Python 3.4, with 2.7 as the default. To run a modern Python script, use the "Run application" or "Run DOS command" action to call your local python.exe instead.

Can Power Automate cloud flows run Python by themselves?

No, cloud flows can't run a Python script on their own. You need Power Automate for desktop on a Windows PC, or an alternative like Button if you just need a web form that runs the script on your computer.

Do my colleagues need to pay or install Python to use Button?

No. Colleagues open the link from their invite email, sign in with Google or a one-time email code, fill in the form in their browser and download the results without installing anything or paying.

Where does the Python script run when someone uses Button?

The job runs on your computer, never in Button's cloud, while Button's servers relay the form values and files between the browser and your computer. Your computer has to be on and online for colleagues to run the tool.

Last updated

Put your script behind a form

Button turns a script on your computer into a web form. Colleagues sign in, fill it in, press Run and download the results. Free for 1 tool and 3 people.