From fffd0e3d53a6a27fa038d6e2bce6d919f3f9ba25 2016-02-21 09:39:17 From: Dmitry Zotikov Date: 2016-02-21 09:39:17 Subject: [PATCH] Use if instead of try..except --- diff --git a/IPython/core/page.py b/IPython/core/page.py index df38ddf..4b29faa 100644 --- a/IPython/core/page.py +++ b/IPython/core/page.py @@ -309,11 +309,8 @@ def get_pager_cmd(pager_cmd=None): except: pager_cmd = default_pager_cmd - if pager_cmd == 'less': - try: - os.getenv('LESS').index('-r') - except (ValueError, AttributeError): - pager_cmd += ' -r' + if pager_cmd == 'less' and '-r' not in os.environ.get('LESS', ''): + pager_cmd += ' -r' return pager_cmd