[New-bugs-announce] [issue24888] FileNotFoundException raised by subprocess.call

Geoffrey Royer report at bugs.python.org
Tue Aug 18 16:36:31 CEST 2015


New submission from Geoffrey Royer:

According to the documentation of the subprocess.check_call function: https://docs.python.org/3/library/subprocess.html#subprocess.check_call

It would be nice to notify the reader that this function can raise FileNotFoundException. It is raised in case when the binary one wants to call does not exist.

Example:

Python 3.4.0 (default, Jun 19 2015, 14:20:21) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.check_call(["foo", "bar"])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.4/subprocess.py", line 552, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python3.4/subprocess.py", line 533, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.4/subprocess.py", line 848, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.4/subprocess.py", line 1446, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'foo'

----------
assignee: docs at python
components: Documentation
messages: 248773
nosy: Geoffrey Royer, docs at python
priority: normal
severity: normal
status: open
title: FileNotFoundException raised by subprocess.call

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24888>
_______________________________________


More information about the New-bugs-announce mailing list