Skip to main content

Notifications

Community site session details

Community site session details

Session Id : L7DHrrCwTkYr8IbLXOIeCq
Power Automate - Building Flows
Answered

Run PowerShell script error: PermissionError: [Errno 13] Permission denied:

Like (0) ShareShare
ReportReport
Posted on 16 Jan 2022 17:53:58 by

Hi,

 

Currently, I am working on a demo of my python script project and in a middle of trouble, the power automate desktop cannot run my script in powershell completely. I had checked my script in Windows Powershell and Windows Powershell ISE again, it ran correctly. While I am trying to use my script into PA the script error is: 

 

Thank you in advance!

 

 

 

Traceback (most recent call last):
File "C:\Users\USER\Desktop\Program\bkf\plot.py", line 34, in plot
plt.savefig('plot_2.png')
File "C:\Users\USER\.virtualenvs\bkf-LeCHbn9v\lib\site-packages\matplotlib\pyplot.py", line 966, in savefig
res = fig.savefig(*args, **kwargs)
File "C:\Users\USER\.virtualenvs\bkf-LeCHbn9v\lib\site-packages\matplotlib\figure.py", line 3015, in savefig
self.canvas.print_figure(fname, **kwargs)
File "C:\Users\USER\.virtualenvs\bkf-LeCHbn9v\lib\site-packages\matplotlib\backend_bases.py", line 2255, in print_figure
result = print_method(
File "C:\Users\USER\.virtualenvs\bkf-LeCHbn9v\lib\site-packages\matplotlib\backend_bases.py", line 1669, in wrapper
return func(*args, **kwargs)
File "C:\Users\USER\.virtualenvs\bkf-LeCHbn9v\lib\site-packages\matplotlib\backends\backend_agg.py", line 509, in print_png
mpl.image.imsave(
File "C:\Users\USER\.virtualenvs\bkf-LeCHbn9v\lib\site-packages\matplotlib\image.py", line 1616, in imsave
image.save(fname, **pil_kwargs)
File "C:\Users\USER\.virtualenvs\bkf-LeCHbn9v\lib\site-packages\PIL\Image.py", line 2237, in save
fp = builtins.open(filename, "w+b")
PermissionError: [Errno 13] Permission denied: 'plot_2.png'

 

 

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on 19 Jan 2022 at 07:03:56
    Re: Run PowerShell script error: PermissionError: [Errno 13] Permission denied:

    Hi @Chinnapan,

    Do you want to run the python script in Power Apps?

    Could you please tell me that if you import it from a PCF?

     

    If you use a PCF to run the python script within Power Apps, I am afraid it is a huge work load for you.

    To achieve your need, I think you could check the following steps.

    1. From a slider input in Power Apps save the datapoint to a SharePoint list (SPOL)
    2. From Python on a Raspberry Pi connect to SPOL using the SharePlum library - alternatively, you can use Graph API as well.
    3. Get the value from SPOL and send it to your controller.
    4. Now if you want to run the Python code on your desktop, you could do what is called a "Desktop Flow" in Microsoft Power Automate. Once you have this flow recorded (it has a desktop recorder), you could combine it with an "instant flow" in Power Automate (this allows you to press a button in Power Apps) that would allow you to "initialize" the python code.

    Here is an video you could check for details:

    Sanjiv Venkatram on LinkedIn: #aseansmsbizappsug #aseansmswomenintech #powerapps | 18 comments

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 91

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 70 Super User 2025 Season 1

#3
David_MA Profile Picture

David_MA 48 Super User 2025 Season 1

Overall leaderboard
Loading started