Mam do uruchomienia skrypt power shella
z poziomu pythona metodą subprocess
Wyskakuje mi taki błąd:
Error: [NodeId: ReadOp@sourceProduct] Specified 'file' [.0] does not exist.
Implementacja:
def run_process(command):
"""Running process
==========
.
==========
Function to run process. Platform independent.\n
**Argument**:
--------
- *command* - (require) command to run in shell."""
if platform.system() == "Linux":
subprocess.call(command, shell=True)
elif platform.system() == "Windows":
script_name = "script.ps"
script = open(script_name,"w+")
script.write(command)
script.close()
process_list = command.split('\n')
for x in range(len(process_list)):
subprocess.call(str("PowerShell.exe" + " " + str(process_list[x])),stdout=sys.stdout)
else:
print("Unsupported platform.")
Czy w ten sposób powinienem uruchamiać skrypty power shella?
Po wygenerowaniu skryptu i zrobieniu copy paste do konsoli power shella wszystko działa