web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Help needed running Py...
Power Automate
Unanswered

Help needed running Python script in a PAD flow - no output and no error?

(0) ShareShare
ReportReport
Posted on by

Hello Everyone.

 

I have added this Python script to my flow as a test.

 

import requests

 

def is_website_online(url):
try:
response = requests.get(url)
return response.status_code == 200
except requests.exceptions.RequestException:
return False

def check_multiple_websites(websites):
for website in websites:
status = "Online" if is_website_online(website) else "Offline"
print("{} is {}".format(website, status))

if __name__ == "__main__":
websites_to_check = [
"https://www.example.com",
"https://www.google.com",
"https://www.github.com",
"https://www.nonexistentwebsite1234.com" # Add more websites to check
]

check_multiple_websites(websites_to_check)

 

I have set up the Run Python Script flow action like this - is the module file path correct?

ianwuk_1-1691019969666.png

 

When my flow runs, there is no output from the Python script stored in the output variable, and no error either.

 

However, when I run the same script in VS Code it works as expected and displays the correct output.

 

What am I doing wrong here? The PAD machine has Python 2.7 installed.

 

Many thanks.

I have the same question (0)
  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Try enabling the ScriptError variable to see if the Python script actually returns any errors.

    Agnius_0-1691037988098.png

     

    It is disabled by default.

     

    Also, why exactly are you using a Python script launched from PAD to send GET requests? There is a Invoke web service action in PAD that can do it. If you want to use Python, why use PAD at all? If you need to use PAD, why use Python for things that PAD can do natively?

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • CU-19081228-9 Profile Picture
    on at

    Thanks for replying @Agnius , I'm just playing around with the Python feature now to see if I can at least get it to work before using it more accurately in future PAD flows.

     

    I'm not sure if I had that option to enable the Python error or not, turns out, under Advanced for the Run Python Script flow action I just have the Module file paths option, nothing related to ScriptError.

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Scroll down below and you'll find another section called "Variables produced" below the "Advanced" section. That's where the variables are.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard