Issue1748

classification
Title: subprocess and os.system doesnt show output
Type: behaviour Severity: normal
Components: Versions: Jython 2.7
Milestone:
process
Status: pending Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: fwierzbicki, jeff.allen, ssteiner, zyasoft
Priority: low Keywords:

Created on 2011-05-25.15:08:33 by ssteiner, last changed 2018-03-17.13:26:03 by jeff.allen.

Messages
msg6527 (view) Author: simon steiner (ssteiner) Date: 2011-05-25.15:08:32
in python i get:
OSError: Drive already SUBSTed

in jython i get:
OSError


import subprocess
p_subst = subprocess.Popen('subst z: "c:\\"',  shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
errmsg = p_subst.communicate()[0]
if p_subst.returncode != 0:
    raise OSError(errmsg)
msg6529 (view) Author: simon steiner (ssteiner) Date: 2011-05-26.08:34:05
also doesnt output 'Drive already SUBSTed'

import os
os.system('subst z: "c:\\"')
msg9342 (view) Author: Jim Baker (zyasoft) Date: 2015-01-07.08:11:22
Is this a limitation of Windows? It works fine on Unix-list systems:

>>> import os
>>> os.system("ls ~/jythondev/jython27/dist/bin/*")
/Users/jbaker/jythondev/jython27/dist/bin/easy_install		/Users/jbaker/jythondev/jython27/dist/bin/pip
/Users/jbaker/jythondev/jython27/dist/bin/easy_install-2.7	/Users/jbaker/jythondev/jython27/dist/bin/pip2
/Users/jbaker/jythondev/jython27/dist/bin/jython		/Users/jbaker/jythondev/jython27/dist/bin/pip2.7
/Users/jbaker/jythondev/jython27/dist/bin/jython.bat
0
msg9343 (view) Author: Jim Baker (zyasoft) Date: 2015-01-07.08:11:40
Unix-like
msg9493 (view) Author: Jim Baker (zyasoft) Date: 2015-02-07.01:34:23
Looks like a basic limitation of working on Windows for Jython. Revisit at a later time.
msg11822 (view) Author: Jeff Allen (jeff.allen) Date: 2018-03-17.13:26:02
There have been numerous fixes in subprocess since this issue. This works for me in Jython 2.7.2a1:

C:\Users\Jeff\Documents\Jython\bugs>jython
Jython 2.7.2a1+ (default:d74f8c2cd56f, Feb 24 2018, 17:18:53)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_151
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.system("subst a: .")
Drive already SUBSTed
1
>>> import subprocess
>>> p_subst = subprocess.Popen('subst z: "c:\\"',  shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
>>> p_subst = subprocess.Popen('subst a: "."',  shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
>>> errmsg = p_subst.communicate()[0]
>>> errmsg
'Drive already SUBSTed\r\n'

Propose to close.
History
Date User Action Args
2018-03-17 13:26:03jeff.allensetstatus: open -> pending
resolution: remind -> fixed
messages: + msg11822
nosy: + jeff.allen
versions: + Jython 2.7, - Jython 2.5
2015-02-07 01:34:23zyasoftsetmessages: + msg9493
2015-01-07 08:11:40zyasoftsetmessages: + msg9343
2015-01-07 08:11:22zyasoftsetmessages: + msg9342
2014-05-21 23:04:00zyasoftsetnosy: + zyasoft
2013-11-26 20:39:02fwierzbickisetfiles: - g-c44.html
2013-11-25 14:47:50hunterbowler31setfiles: + g-c44.html
2013-11-21 22:52:57jeff.allensetfiles: - ll44.html
2013-11-19 20:06:56hunterbowler31setfiles: + ll44.html
2013-02-19 21:15:55fwierzbickisetpriority: low
nosy: + fwierzbicki
resolution: remind
versions: + Jython 2.5, - 2.5.0
2011-05-26 08:34:45ssteinersettitle: subprocess doesnt show error -> subprocess and os.system doesnt show output
2011-05-26 08:34:05ssteinersetmessages: + msg6529
2011-05-25 15:08:33ssteinercreate