From 55db07c79f2538e1983bad3b60abd921d9550820 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 16 Oct 2017 18:52:17 +0530 Subject: [PATCH] Only display Lenna if she exists in the gr script --- kitty_tests/gr.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/kitty_tests/gr.py b/kitty_tests/gr.py index 7cc670c14..9d3a53959 100644 --- a/kitty_tests/gr.py +++ b/kitty_tests/gr.py @@ -2,9 +2,10 @@ # vim:fileencoding=utf-8 # License: GPL v3 Copyright: 2017, Kovid Goyal +import os +import subprocess import sys import zlib -import subprocess from base64 import standard_b64encode write = getattr(sys.stdout, 'buffer', sys.stdout).write @@ -47,9 +48,13 @@ def main(): move_cursor(5, 8) print('kitty is \033[3m\033[32mawesome\033[m!') move_cursor(0, 21) - print('Lenna...') - subprocess.check_call('python3 kitty/icat.py /t/Lenna.png'.split()) - input() + if os.path.exists('/t/Lenna.png'): + print('Lenna...') + subprocess.check_call('python3 kitty/icat.py /t/Lenna.png'.split()) + try: + raw_input() + except NameError: + input() if __name__ == '__main__':