Issue1748
 
            
            
            
Created on 2011-05-25.15:08:33 by ssteiner, last changed 2018-11-04.16:03:10 by jeff.allen. 
 |
 
   | 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. |  |
 
| Date | User | Action | Args |  | 2018-11-04 16:03:10 | jeff.allen | set | status: pending -> closed |  | 2018-03-17 13:26:03 | jeff.allen | set | status: open -> pending resolution: remind -> fixed
 messages:
  + msg11822
 nosy:
  + jeff.allen
 versions:
  + Jython 2.7, - Jython 2.5
 |  | 2015-02-07 01:34:23 | zyasoft | set | messages:
  + msg9493 |  | 2015-01-07 08:11:40 | zyasoft | set | messages:
  + msg9343 |  | 2015-01-07 08:11:22 | zyasoft | set | messages:
  + msg9342 |  | 2014-05-21 23:04:00 | zyasoft | set | nosy:
  + zyasoft |  | 2013-11-26 20:39:02 | fwierzbicki | set | files:
  - g-c44.html |  | 2013-11-25 14:47:50 | hunterbowler31 | set | files:
  + g-c44.html |  | 2013-11-21 22:52:57 | jeff.allen | set | files:
  - ll44.html |  | 2013-11-19 20:06:56 | hunterbowler31 | set | files:
  + ll44.html |  | 2013-02-19 21:15:55 | fwierzbicki | set | priority: low nosy:
  + fwierzbicki
 resolution: remind
 versions:
  + Jython 2.5, - 2.5.0
 |  | 2011-05-26 08:34:45 | ssteiner | set | title: subprocess doesnt show error -> subprocess and os.system doesnt show output |  | 2011-05-26 08:34:05 | ssteiner | set | messages:
  + msg6529 |  | 2011-05-25 15:08:33 | ssteiner | create |  | 
 |