2
votes

What is the meaning of this paradoxical error?

subprocess.CalledProcessError: Command '/home/travis/build/fritzo/pomagma/build/debug/src/cartographer/cartographer' returned non-zero exit status 0

It happens when I start a subprocess, then tell that subprocess to cleanly exit via a zmq socket. It appears that while zmq is polling, the process exits cleanly (exit code 0), and then this error is raised.

Here's the whole traceback (from a travis log):

Traceback (most recent call last):
  File "/home/travis/virtualenv/python2.7_with_system_site_packages/bin/pomagma.make", line 9, in <module>
    load_entry_point('pomagma==0.2.8', 'console_scripts', 'pomagma.make')()
  File "/home/travis/virtualenv/python2.7_with_system_site_packages/local/lib/python2.7/site-packages/parsable.py", line 181, in dispatch
    dispatch(argv)
  File "/home/travis/virtualenv/python2.7_with_system_site_packages/local/lib/python2.7/site-packages/parsable.py", line 129, in dispatch
    parser(*args, **kwargs)
  File "/home/travis/virtualenv/python2.7_with_system_site_packages/local/lib/python2.7/site-packages/parsable.py", line 64, in parser
    fun(*typed_args, **typed_kwargs)
  File "/home/travis/build/fritzo/pomagma/pomagma/make.py", line 130, in test_atlas
    _test_atlas(theory)
  File "/home/travis/build/fritzo/pomagma/pomagma/make.py", line 59, in _test_atlas
    assert actual_size == expected_size
  File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/home/travis/build/fritzo/pomagma/pomagma/cartographer/__init__.py", line 14, in load
    client.stop()
  File "/home/travis/build/fritzo/pomagma/pomagma/cartographer/client.py", line 207, in stop
    self._call(request)
  File "/home/travis/build/fritzo/pomagma/pomagma/cartographer/client.py", line 35, in _call
    self._poll_callback()
  File "/home/travis/build/fritzo/pomagma/pomagma/cartographer/server.py", line 66, in check
    self.log_error()
  File "/home/travis/build/fritzo/pomagma/pomagma/cartographer/server.py", line 73, in log_error
    raise CalledProcessError(self._proc.poll(), BINARY)
subprocess.CalledProcessError: Command '/home/travis/build/fritzo/pomagma/build/debug/src/cartographer/cartographer' returned non-zero exit status 0
1

1 Answers

0
votes

According to the docs, if your subprocess returns non-zero then it will raise that exception. This is also the standard convention in Linux. https://docs.python.org/2/library/subprocess.html

Try to include your subprocess client code try: <...> catch: <...> finally: sys.exit(0)