I have a Powershell script that is working and a Python script that is working. I would like to have the Python script run the powershell script for me. I am unable to download any packages because this is on a work computer.
I did look into this before asking and found/tried the following codes:
import subprocess, sys p = subprocess.Popen(‘powershell.exe -ExecutionPolicy RemoteSigned -file “file location”’, stdout=sys.stdout) p.communicate()
import subprocess, sys p = subprocess.run(‘powershell.exe -ExecutionPolicy RemoteSigned -file “file location”’, shell=True) p.communicate()
This seems to be the answer on every Reddit/SO question I’ve seen so I’m unsure why it doesn’t work for me. Does anyone know how to fix this? Or any work around?
Thank you in advance!
Leave an answer