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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Using Python Script wi...
Power Automate
Answered

Using Python Script with Modules in Power Automate Desktop

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi All,

 

I am trying to run a python script with the getpass module. I have put the module into a folder and given the path to Power Automate Desktop. I keep getting this error. Any suggestions?

 

 

python Error.jpgPython ScriptPython Script

 

I have the same question (0)
  • fraenK Profile Picture
    2,125 on at

    Are you aware that PAD is using IronPython, version 2.7.9.1?

  • burque505 Profile Picture
    398 on at

    @Anonymous, here you go. Just needs the path to your modules to be changed to what you have.

    Also, you were using Python 3 syntax for the print statement, which I always forget and do myself. 😀

     

    working.png

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    No I wasn't, I am unfamiliar with IronPython. What does it allow us to do? 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @burque505, I copied your code and I am receiving the same error. Would you please explain what your code is doing so I can fix mine. 

     

    Thanks,

  • Verified answer
    burque505 Profile Picture
    398 on at

    Hi @Anonymous, sorry I wasn't more clear. I was assuming (maybe wrongly) that the Python folder on your desktop contains version 2.7. If it doesn't (if it's Python 3 for instance) you would need to install Python 2.7 somewhere. You don't need to add it to your path, PAD just needs to be able to find the 2.7 modules/libs so PAD's IronPython can import from there.

    Here's my code in the Action.

     

     

     

    import sys
    sys.path.append(r"c:\Python27\Lib")
    import getpass
    machineUserName = getpass.getuser()
    print machineUserName

     

     

     

     Here is what you'll have to put in (changing "JackMelvin" to what I can't read to what it is in the actual path):

     

     

     

    import sys
    sys.path.append(r"C:\Users\JackMelvin\Desktop\Python\Mods")
    import getpass
    machineUserName = getpass.getuser()
    print machineUserName

     

     

     

     

     You might look in that folder to make sure 'getpass.py' is in there.

  • fraenK Profile Picture
    2,125 on at

    https://ironpython.net/

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 632

#2
Haque Profile Picture

Haque 458

#3
Valantis Profile Picture

Valantis 357

Last 30 days Overall leaderboard