Hi All,
i hame on simple code.
same code is working when i am using customer specific tool command . but same code is not working on other command,
example:-
mycommand1 --is working, with in python and on window cmd prompt when i test it manually
mycommand2 --is not working in python , but working on cmd prompt but its taking 20-40 second to exceute on command prompt while testing it manually ,is it because of delay this code is not working on mycommand2 ?
i hame on simple code.
same code is working when i am using customer specific tool command . but same code is not working on other command,
example:-
mycommand1 --is working, with in python and on window cmd prompt when i test it manually
mycommand2 --is not working in python , but working on cmd prompt but its taking 20-40 second to exceute on command prompt while testing it manually ,is it because of delay this code is not working on mycommand2 ?
import subprocess as sp a=sp.run('mycommand',shell = True) rc=a.returncode print("This is returen code {}".format(rc)) if (rc==0): print("Command working fine") output = sp.run('mycommand',capture_output = True, text = True) print(output.stdout) else: print("There is error in this command")-------------
Error:Error
output = sp.run('opcagt',capture_output = True, text = True)
File "C:\Python38-32\lib\subprocess.py", line 489, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Python38-32\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Python38-32\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified