This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2009年04月21日 15:49 by mrwizard82d1, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Messages (6) | |||
|---|---|---|---|
| msg86242 - (view) | Author: Lawrence Allan Jones (mrwizard82d1) | Date: 2009年04月21日 15:49 | |
When attempting to use the subprocess.getstatusoutput() function on
Windows, I noticed an unusual error message:
"'{' is not recognized as an internal or external command,
operable program or batch file."
When the output contained this message, the status was always 256.
From the interactive prompt, I performed the following:
Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> cmdline = 'dir'
>>> (status, output) = subprocess.getstatusoutput(cmdline)
>>> status
256
>>> output
"'{' is not recognized as an internal or external command,\noperable
program or
batch file."
>>>
I think this is an error (but it is possible I misunderstand the
documentation for the function :) .)
|
|||
| msg86243 - (view) | Author: Lawrence Allan Jones (mrwizard82d1) | Date: 2009年04月21日 15:56 | |
Oops: user error. The manual states that subprocess.getstatusoutput() is only open under Unix. Somehow :) I missed this note. Sorry for wasting bandwidth. |
|||
| msg91005 - (view) | Author: Sorin Sbarnea (ssbarnea) * | Date: 2009年07月28日 11:17 | |
Also the same issue does apply for command.getstatusoutput in Python 2.6. Maybe this bug should be reopened and solved by adding a platform check in the module. Also the documentation does not specify what would be the right multiplatform alternative. Anyway, the current result it's clearly not the expected behavior and does not give any hint regarding the source of the problem or possible solutions. |
|||
| msg91011 - (view) | Author: Senthil Kumaran (orsenthil) * (Python committer) | Date: 2009年07月28日 17:20 | |
sorin: You meant the commands module, correct? It is well documented in the commands reference: http://docs.python.org/library/commands.html * It is applicable to unix only. * the getstatusoutput is moved to subprocess in 3x. |
|||
| msg91013 - (view) | Author: Sorin Sbarnea (ssbarnea) * | Date: 2009年07月28日 18:17 | |
If I made a patch that will raise an error if you include commands module under Windows will you include it - this will safe others time. |
|||
| msg110424 - (view) | Author: Matthieu Labbé (matthieu.labbe) | Date: 2010年07月16日 10:01 | |
I think this is a bug: The doc says "Availability: UNIX." but it is *available* under Windows and gives an unexpected error message. I see several way to fix this: 1) Fix the doc: "Supported only on UNIX. Behavior on other platforms is undefined." 2) Make subprocess.getstatusoutput (and subprocess.getoutput) unavailable on non-supported platforms. (Same behavior as the 'os' module.) 3) Make these convenience functions multiplatform using subprocess.Popen. I think the best thing to do is #3. What do you think? |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:48 | admin | set | github: 50058 |
| 2012年08月20日 03:57:25 | r.david.murray | set | superseder: subprocess.getoutput fails on win32 |
| 2010年07月16日 10:01:44 | matthieu.labbe | set | nosy:
+ matthieu.labbe messages: + msg110424 |
| 2009年07月28日 18:17:41 | ssbarnea | set | messages: + msg91013 |
| 2009年07月28日 17:20:49 | orsenthil | set | nosy:
+ orsenthil messages: + msg91011 |
| 2009年07月28日 11:17:22 | ssbarnea | set | type: behavior messages: + msg91005 nosy: + ssbarnea |
| 2009年04月21日 18:42:13 | benjamin.peterson | set | resolution: not a bug |
| 2009年04月21日 15:56:03 | mrwizard82d1 | set | status: open -> closed messages: + msg86243 |
| 2009年04月21日 15:49:32 | mrwizard82d1 | create | |