cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Chinnapan
New Member

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

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'

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

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

 

Best Regards,
Qi

View solution in original post

1 REPLY 1
v-qiaqi-msft
Community Support
Community Support

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

 

Best Regards,
Qi

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (5,213)