On 09Apr2012 12:02, Janis <janis.vik...@gmail.com> wrote: | Thank you all for the help! I will need to think a bit about the other | suggestions. | | But, Alan, as to this: | > > How do you get -9 and -15? Exit status is supposed to be between 0 and | > > 127. | | I have the following code that has caught these: | | p = subprocess.Popen([Config.PYTHON_EXE,'Load.py',"%s" % (row[1],)], | bufsize=0, executable=None, stdin=None, stdout=None, | stderr=subprocess.PIPE, preexec_fn=None, close_fds=False, shell=False, | cwd='../Loader/') | stdout, stderr = p.communicate() | if p.returncode != 0: | ... | | So you say it's SIGKILL and SIGTERM? Then I guess these could be | misleading statuses from those cases when I have terminated the | sessions myself, and when there is the real problem apparently the | caller detected nothing here. SIGKILL and SIGTERM would probably also | explain why there was nothing in stderr.
It is certainly SIGKILL and SIGTERM. See citation from docs below. Background: wait() and its modern counterpart waitpid() put the process exit status into an int, which is signed. The exit status seen _in_the_shell_ is as described (0-255) but the raw status from the OS is encoded in an int, and will generally be negative is the process terminated from a signal. You're meant (in C) to inspect it via a set of macros which understand this stuff. If you read the documentation for the subprocess module it says: Popen.returncode The child return code, set by poll() and wait() (and indirectly by communicate()). A None value indicates that the process hasn’t terminated yet. A negative value -N indicates that the child was terminated by signal N (Unix only). So there you go. SIGKILL and SIGTERM, definitely. RTFM. It is your friend. Cheers, -- Cameron Simpson <c...@zip.com.au> DoD#743 http://www.cskk.ezoshosting.com/cs/ Gabriel Genellina: See PEP 234 http://www.python.org/dev/peps/pep-0234/ Angus Rodgers: You've got to love a language whose documentation contains sentences beginning like this: "Among its chief virtues are the following four -- no, five -- no, six -- points: [...]" from python-list@python.org -- http://mail.python.org/mailman/listinfo/python-list