Title: subproces cannot run Windows batch file from current dir which was not starting dir
Type: Severity: normal
Components: Library Versions: Jython 2.5
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: fwierzbicki, mniklas, santa4nt
Priority: Keywords:

Created on 2013-03-04.10:04:14 by mniklas, last changed 2013-03-20.03:56:07 by santa4nt.

File name Uploaded Description Edit Remove mniklas, 2013-03-04.10:04:13 Program that creates batch and tries to run it from selected directory
msg7899 (view) Author: MichaƂ Niklas (mniklas) Date: 2013-03-04.10:04:13
I have problem when my Jython program tries to execute
Windows batch file which is the current directory, but this directory
is not the directory the program was started in.

Test program: is attached.

In CPython this works well:

Trying to execute: "batch_test.bat" in dir: "C:\share\mn\test"
file exists: C:\share\mn\test\batch_test.bat

C:\share\mn\test>time /t

In Jython I got strange exception:

Trying to execute: "batch_test.bat" in dir: "C:\share\mn\test"
file exists: C:\share\mn\test\batch_test.bat
Exception while trying to execute batch_test.bat
Traceback (most recent call last):
  File "", line 21, in execute_cmd_args
    proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "D:\jython2.5.3\Lib\", line 751, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "D:\jython2.5.3\Lib\", line 1265, in _execute_child
    raise OSError(e.getMessage() or e)
OSError: Cannot run program "batch_test.bat" (in directory "C:\share\mn\test"): CreateProcess error=2, The system cannot find the file specified

I think this is a bun in Jython subprocess module.
Date User Action Args
2013-03-20 03:56:08santa4ntsetnosy: + santa4nt
2013-03-04 17:43:22fwierzbickisetnosy: + fwierzbicki
2013-03-04 10:04:14mniklascreate