From 4738480e62034a47c2e63d98f7d7592d6f15c556 Mon Sep 17 00:00:00 2001 From: Masafumi Oyamada Date: Sun, 15 Mar 2015 23:16:08 +0900 Subject: [PATCH] Raise error if a specified input file is not readable --- percol/cli.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/percol/cli.py b/percol/cli.py index 810b23d..4fc997b 100644 --- a/percol/cli.py +++ b/percol/cli.py @@ -217,6 +217,10 @@ def open_tty(ttyname): filename = args[0] if len(args) > 0 else None + if filename and not os.access(filename, os.R_OK): + exit_program(error_message("Cannot read a file '" + filename + "'"), + show_help=False) + if filename is None and sys.stdin.isatty(): tty_f.write(INSTRUCTION_TEXT) exit_program(show_help = False)