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 / Run PowerShell script ...
Power Automate
Answered

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

(0) ShareShare
ReportReport
Posted on 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'

 

 

Categories:
I have the same question (0)
  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on at

    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

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 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard