Error goes to debugger

Issue #10 resolved
Former user created an issue

$ which python /opt/python/bin/python

$ cat temp.py import sarge print(sarge.get_stdout("lss")) # lss is intentionally not a valid command

$ /opt/python/bin/python Python 3.3.2 (default, Jun 24 2013, 11:57:06) [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux Type "help", "copyright", "credits" or "license" for more information.

$ /opt/python/bin/python temp.py

/opt/python/lib/python3.3/site-packages/sarge/init.py(576)wait() -> logger.warning('No process found for %s', self) (Pdb) q Traceback (most recent call last): File "/opt/python/lib/python3.3/site-packages/sarge/init.py", line 1259, in run p.run(input=input, async=async) File "/opt/python/lib/python3.3/site-packages/sarge/init.py", line 904, in run self.run_node(self.tree, input=input, async=async) File "/opt/python/lib/python3.3/site-packages/sarge/init.py", line 992, in run_node result = getattr(self, method)(node, input, async) File "/opt/python/lib/python3.3/site-packages/sarge/init.py", line 1126, in run_command_node node.cmd.run(input=input, async=async) File "/opt/python/lib/python3.3/site-packages/sarge/init.py", line 541, in run self.process = p = Popen(self.args, **self.kwargs) File "/opt/python/lib/python3.3/subprocess.py", line 820, in init restore_signals, start_new_session) File "/opt/python/lib/python3.3/subprocess.py", line 1438, in _execute_child raise child_exception_type(errno_num, err_msg) FileNotFoundError: [Errno 2] No such file or directory: 'lss'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "temp.py", line 2, in <module> print(sarge.get_stdout("lss")) File "/opt/python/lib/python3.3/site-packages/sarge/init.py", line 1296, in get_stdout p = capture_stdout(cmd, kwargs) File "/opt/python/lib/python3.3/site-packages/sarge/init.py", line 1269, in capture_stdout return run(cmd, kwargs) File "/opt/python/lib/python3.3/site-packages/sarge/init.py", line 1259, in run p.run(input=input, async=async) File "/opt/python/lib/python3.3/site-packages/sarge/init.py", line 144, in exit self.close() File "/opt/python/lib/python3.3/site-packages/sarge/init.py", line 960, in close cmd.wait() File "/opt/python/lib/python3.3/site-packages/sarge/init.py", line 576, in wait logger.warning('No process found for %s', self) File "/opt/python/lib/python3.3/site-packages/sarge/init.py", line 576, in wait logger.warning('No process found for %s', self) File "/opt/python/lib/python3.3/bdb.py", line 47, in trace_dispatch return self.dispatch_line(frame) File "/opt/python/lib/python3.3/bdb.py", line 66, in dispatch_line if self.quitting: raise BdbQuit bdb.BdbQuit

I was expecting the call to sarge.get_stdout("lss") to throw an error and the script to stop running.

Comments (1)

  1. Vinay Sajip repo owner

    This was fixed some time ago. Can you verify with the tip revision? Here's what I get now (with Python 3.3):

    >>> import sarge; sarge.get_stdout('lss')
    No process found for Command('lss')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "./sarge/__init__.py", line 1345, in get_stdout
        p = capture_stdout(cmd, **kwargs)
      File "./sarge/__init__.py", line 1318, in capture_stdout
        return run(cmd, **kwargs)
      File "./sarge/__init__.py", line 1308, in run
        p.run(input=input, async=async)
      File "./sarge/__init__.py", line 950, in run
        self.run_node(self.tree, input=input, async=async)
      File "./sarge/__init__.py", line 1038, in run_node
        result = getattr(self, method)(node, input, async)
      File "./sarge/__init__.py", line 1173, in run_command_node
        node.cmd.run(input=input, async=async)
      File "./sarge/__init__.py", line 574, in run
        self.process = p = Popen(self.args, **self.kwargs)
      File "/usr/local/lib/python3.3/subprocess.py", line 820, in __init__
        restore_signals, start_new_session)
      File "/usr/local/lib/python3.3/subprocess.py", line 1438, in _execute_child
        raise child_exception_type(errno_num, err_msg)
    FileNotFoundError: [Errno 2] No such file or directory: 'lss'
    >>> 
    
  2. Log in to comment