1

I'm making a test case, and whenever I call subprocess, I get the following error.

  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python', 'TestRunner/TestRunner.py', '-r', '1000000']' returned non-zero exit status -11

The thing is, how I'm suppose to extract the actual error message?

I do not get anything from exit status -11.

Are there any temp file which stores the error details?

Thanks.

  • 2
    Have you seen this? http://stackoverflow.com/questions/3630389/python-error-codes – McGlothlin Oct 26 '15 at 20:53
  • Did you mean exit status -1? – Yu Zhang Oct 26 '15 at 20:53
  • Its exit status -11 not -1 – Toshihiro M Sakurai Oct 26 '15 at 20:54
  • The error details (if any) are specific to the process that was run. If the process produced `stderr` output, you can look at that (if you're running without a terminal, you can open a file and pass `stdout=fileobj` and/or `stderr=fileobj` to send the output the process produced to a file to check (or use `Popen` instead of `check_call` with `stdout=subprocess.PIPE` and `stderr=subprocess.PIPE` and you can call `.communicate()` on the `Popen` object to read it into your Python process). Aside from that, process exit codes are not standardized; it's up to the program run what each code means. – ShadowRanger Oct 26 '15 at 20:54
  • By looking for Glothlin's link, looks like it's segmentation failure, weird. – Toshihiro M Sakurai Oct 26 '15 at 20:55
  • 1
    Or ignore me and look at what @McGlothlin linked; forgot about the "negative status means killed by signal" rule. – ShadowRanger Oct 26 '15 at 20:58
  • install [`faulthandler`](https://pypi.python.org/pypi/faulthandler/), to get the Python traceback on crash. – jfs Oct 27 '15 at 05:09
  • Looks like this problem is specific to Linux.... – Toshihiro M Sakurai Oct 27 '15 at 19:11

2 Answers2

2

Try running the command manually:

/usr/bin/python TestRunner/TestRunner.py -r 1000000

If the -11 return is interpreted as "exited with signal 11 (Seg fault)", the shell should print a message saying such.

ajfabbri
  • 421
  • 3
  • 5
2

To elaborate on my comment:

Based on the link I provided, it looks like you're running into a segfault because a thread did something it wasn't supposed to. Perhaps it would be helpful to check out this link as well: https://wiki.python.org/moin/CrashingPython

You can also try the highest voted answer in this question. I have little experience debugging segfaults in Python specifically, but that's where I'd start looking.

Community
  • 1
  • 1
McGlothlin
  • 2,059
  • 1
  • 15
  • 28