Python Forum
Calling exe on network drive - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Calling exe on network drive (/thread-36144.html)



Calling exe on network drive - GrahamL - Jan-20-2022

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?


RE: Calling exe on network drive - ibreeden - Jan-21-2022

Try this:
d = r"x:\RequirmentsEditorInstall.exe"



RE: Calling exe on network drive - GrahamL - Jan-21-2022

(Jan-21-2022, 09:04 AM)ibreeden Wrote: Try this:
d = r"x:\RequirmentsEditorInstall.exe"

Unfortunately I get the same result


RE: Calling exe on network drive - ibreeden - Jan-21-2022

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?


RE: Calling exe on network drive - GrahamL - Jan-21-2022

(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