Python Forum

Full Version: Calling exe on network drive
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi
I am trying to call an exe on a network drive
d = "x:\\\RequirmentsEditorInstall.exe"
subprocess.run([d,
                     '/silent',
                     ])
When this runs I get the following
Traceback (most recent call last):
  File "C:\Azure Devops\Agents\TPG\_work\_temp\6f42d270-a33f-46f5-adb5-9ac9afd9a6c0.py", line 22, in <module>
    subprocess.run([d,
  File "C:\Program Files\Python310\lib\subprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Program Files\Python310\lib\subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\Python310\lib\subprocess.py", line 1435, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

##[error]The process 'C:\Program Files\Python310\pythonw.exe' failed with exit code 1
Finishing: Produce Requirements Editor Reports
If I execute the command manually it succeeds

What am I doing wrong?
Try this:
d = r"x:\RequirmentsEditorInstall.exe"
(Jan-21-2022, 09:04 AM)ibreeden Wrote: [ -> ]Try this:
d = r"x:\RequirmentsEditorInstall.exe"

Unfortunately I get the same result
That is a pity. I am not sure but could it be you are executing your script with pythonW.exe? This is a version without terminal window and so without stdin, stdout and stderr. This may cause the troubles. Can you execute your script with python.exe instead?
(Jan-21-2022, 11:23 AM)ibreeden Wrote: [ -> ]That is a pity. I am not sure but could it be you are executing your script with pythonW.exe? This is a version without terminal window and so without stdin, stdout and stderr. This may cause the troubles. Can you execute your script with python.exe instead?
Hi
Seems the trick is to pass shell=True
Thanks for your hints