[issue4216] subprocess.Popen hangs at communicate() when child exits

2008-10-27 Thread Amy

New submission from Amy <[EMAIL PROTECTED]>:

I have a simple program to call a shell command "service cpboot start"
to start Check Point firewall on RHEL5.1.

=
#!/usr/bin/env python
# vim: softtabstop=4 shiftwidth=4 expandtab

import os
from subprocess import *

p = Popen('service cpboot stop',shell=True, stdout=PIPE)
output = p.communicate()
print 'STDERR: %s' % output[0]
print 'STDOUT: %s' % output[1]

===

Python process pid 13343 spawned child 13375 to run "service cpboot
start".  However, after child process 13375 finished and sent SIGCHLD to
the python script, the parent hangs in Popen function communicate() at
line 1041 and child process 13375 became a defunct process.


Traceback (most recent call last):
  File "./subprocess_test03.py", line 7, in ?
output = p.communicate()
  File "/usr/lib/python2.4/subprocess.py", line 1041, in communicate
rlist, wlist, xlist = select.select(read_set, write_set, [])
KeyboardInterrupt


Here is part of the strace:

Process 13375 detached
[pid 19195] close(878)  = -1 EBADF (Bad file descriptor)
[pid 19195] close(879)  = -1 EBADF (Bad file descriptor)
[pid 19195] close(880)  = -1 EBADF (Bad file descriptor)
[pid 13343] <... select resumed> )  = ? ERESTARTNOHAND (To be restarted)
[pid 19195] close(881 
[pid 13343] --- SIGCHLD (Child exited) @ 0 (0) ---
[pid 19195] <... close resumed> )   = -1 EBADF (Bad file descriptor)
[pid 13343] select(7, [4 6], [], [], NULL 


It seems like the select system call got interrupted and error code was
"ERESTARTNOHAND" was returned. The PIPEs won't be able to terminate
since child process has finished and exited and EOF won't be read from
the PIPEs.

If executing the shell command directly from shell command line, there's
no problem at all.It seems like there might be some race condition
somewhere in the python library. 

Any idea what may cause the problem? Many thanks in advance.

--
components: Library (Lib)
files: subprocess_test03.py
messages: 75270
nosy: amy20_z
severity: normal
status: open
title: subprocess.Popen hangs at communicate() when child exits
type: crash
versions: Python 2.4
Added file: http://bugs.python.org/file11898/subprocess_test03.py

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4216>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4216] subprocess.Popen hangs at communicate() when child exits

2008-10-31 Thread Amy

Amy <[EMAIL PROTECTED]> added the comment:

Yes, I can only replicate this issue with command to start firewall.
Stopping firewall or other service commands don't have the problem.
Check Point firewall is a kernel application. 

Somehow select system call is interrupted and can't terminate the PIPE.
I don't know what interrupt it is, though.

I'll collect the full log and attach it here.

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4216>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30056] RuntimeWarning: invalid value encountered in maximum/minimum

2017-04-12 Thread Amy

New submission from Amy:

I just updated to numpy 1.12.1 and am getting this Runtime Warning when using 
numpy.minimum or numpy.maximum:

RuntimeWarning: invalid value encountered in maximum

Prior to updating, I was using numpy 1.10.x and had no issues running 
numpy.minimum or numpy.maximum

--
messages: 291560
nosy: aching
priority: normal
severity: normal
status: open
title: RuntimeWarning: invalid value encountered in maximum/minimum
type: compile error
versions: Python 3.5

___
Python tracker 
<http://bugs.python.org/issue30056>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23116] Python Tutorial 4.7.1: Improve ask_ok() to cover more input values

2014-12-26 Thread Amy

New submission from Amy:

https://docs.python.org/3/tutorial/controlflow.html#default-argument-values
def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):
while True:
ok = input(prompt)

Suggestion: change to "ok = input(prompt).lower()" in order to cover values 
with capitalized characters such as "Yes" or "NO".

--
messages: 233114
nosy: amyluo
priority: normal
severity: normal
status: open
title: Python Tutorial 4.7.1: Improve ask_ok() to cover more input values
type: enhancement
versions: Python 3.4

___
Python tracker 
<http://bugs.python.org/issue23116>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com