8000 Use STAF call python script will case 1124861 issue in 2.7.2 version · Issue #61552 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Use STAF call python script will case 1124861 issue in 2.7.2 version #61552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gwtking mannequin opened this issue Mar 4, 2013 · 3 comments
Closed

Use STAF call python script will case 1124861 issue in 2.7.2 version #61552

gwtking mannequin opened this issue Mar 4, 2013 · 3 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@gwtking
Copy link
Mannequin
gwtking mannequin commented Mar 4, 2013
BPO 17350
Nosy @terryjreedy

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2013-07-31.19:03:36.782>
created_at = <Date 2013-03-04.13:09:24.935>
labels = ['type-bug']
title = 'Use STAF call python script will case 1124861 issue in 2.7.2 version'
updated_at = <Date 2013-07-31.19:03:36.781>
user = 'https://bugs.python.org/gwtking'

bugs.python.org fields:

activity = <Date 2013-07-31.19:03:36.781>
actor = 'terry.reedy'
assignee = 'none'
closed = True
closed_date = <Date 2013-07-31.19:03:36.782>
closer = 'terry.reedy'
components = []
creation = <Date 2013-03-04.13:09:24.935>
creator = 'gwtking'
dependencies = []
files = []
hgrepos = []
issue_num = 17350
keywords = []
message_count = 3.0
messages = ['183444', '183784', '194008']
nosy_count = 3.0
nosy_names = ['terry.reedy', 'astrand', 'gwtking']
pr_nums = []
priority = 'normal'
resolution = 'out of date'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue17350'
versions = ['Python 2.7']

@gwtking
Copy link
Mannequin Author
gwtking mannequin commented Mar 4, 2013

Here I get one problem use STAF call python and need help.
In python 2.7.2 version I write a script "test.py" as below

import subprocess
fileID=file('test1.log','w')
process_response = subprocess.call('netsh wlan show\ interface',stdout=fileID,shell=True)
fileID.flush()
fileID.close()

It run in windows7 os MSDOS console is OK
and I try to run it in STAF command

C:\> STAF local PROCESS START COMMAND python C:\>test.py WAIT STDERRTOSTDOUT RETURNSTDOUT

Response
--------

{
  Return Code: 1
  Key        : <None>
  Files      : [
    {
      Return Code: 0
      Data       : Traceback (most recent call last):
  File "C:\test.py", line 3, in <module>
    process_response = subprocess.call('netsh wlan show interface',stdout=fileID
,shell=True)
  File "C:\Python27\lib\subprocess.py", line 493, in call
    return Popen(*popenargs, **kwargs).wait()
  File "C:\Python27\lib\subprocess.py", line 672, in __init__
    errread, errwrite) = self._get_handles(stdin, stdout, stderr)
  File "C:\Python27\lib\subprocess.py", line 784, in _get_handles
    p2cread = self._make_inheritable(p2cread)
  File "C:\Python27\lib\subprocess.py", line 823, in _make_inheritable
    _subprocess.DUPLICATE_SAME_ACCESS)
WindowsError: [Error 6] The handle is invalid
}

]

Like known bpo-1124861. I just start to learn python, I dont know how to resolve, need help.

@gwtking gwtking mannequin added the type-crash A hard crash of the interpreter, possibly with a core dump label Mar 4, 2013
@terryjreedy
Copy link
Member

(Peter, the OP claims this issue is similar to a subprocess issue you fixed. I hope you can comment.)

Nearly identical versions of your example run from IDLE on both 2.7.3 and 3.3.0.

Please rerun on 2.7.3 to make sure you have the problem with current Python. And if you do, try again when 2.7.4 comes out (date uncertain).

I have no idea what STAF is, but we on this tracker are not responsible for 3rd party environments. It looks like STAF manipulates i/o streams# in a way that subprocess cannot handle*. The error has nothing to do with the particular command you tried to run. I suggest you present your problem to the STAF people. We can only handles identified problems within our code and we need a reproducible example that runs independent of such 3rd party environments. Without that, we will have to close this.

# IDLE also manipulates the i/o streams and it has had i/o replacement stream bugs that we only fixed within the last 6 months.

  • For instance, I tried to run subprocess with stdout= <StringIO object>, to avoid writing to disk, but that failed, also within _get_handles(stdin, stdout, stderr), because StringIO objects do not have a fileno attribute.

An error traceback is a graceful shutdown. A crash is an exit with no traceback and, on Windows, a popup or worse, a 'blue screen of death' and a reboot. (If you have never seen the latter, good for you and your system ;-).

@terryjreedy terryjreedy added type-bug An unexpected behavior, bug, or error and removed type-crash A hard crash of the interpreter, possibly with a core dump labels Mar 9, 2013
@terryjreedy
Copy link
Member

In in absence of the information needed to consider this a current Python bug, I am closing it as either out-of-date (already fixed) or invalid (a third-party problem).

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant
0