OSError Errno 2 when trying to execute a powershell script r

This is the place for queries that don't fit in any of the other categories.

OSError Errno 2 when trying to execute a powershell script r

Postby py_beginner » Tue Oct 01, 2013 6:34 am

I have a python script on a Linux machine, which I am using to execute powershell scripts present on a remote windows machine. Here is some example code:

Code: Select all
command = [r"c:\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe", ".\"+ path_script]
run_script = subprocess.Popen(command, stderr=subprocess.STDOUT)


path_script is my variable which have exact script location
I'm getting
Code: Select all
 OSError: [Errno 2] No such file or directory


I also tried this, with no success:
Code: Select all
run_script = subprocess.Popen(['cmd', r"c:\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe", ".\"+path_script], shell=True)'


Anyone know why I'm getting this error
Last edited by Yoriz on Tue Oct 01, 2013 10:11 am, edited 1 time in total.
Reason: First post lock
py_beginner
 
Posts: 1
Joined: Tue Oct 01, 2013 6:13 am

Re: OSError Errno 2 when trying to execute a powershell scri

Postby ochichinyezaboombwa » Tue Oct 01, 2013 5:34 pm

there is some more text after
Code: Select all
OSError: [Errno 2]
: did you bother to read it?
ochichinyezaboombwa
 
Posts: 200
Joined: Tue Jun 04, 2013 7:53 pm


Return to General Coding Help

Who is online

Users browsing this forum: Baldyr, conor100, Crimson King, Google [Bot], Larz60+, W3C [Linkcheck] and 1 guest