From 1e3881995497633af134106bee63b8ae0fb985e4 Mon Sep 17 00:00:00 2001 From: gryf Date: Mon, 13 Mar 2017 20:52:43 +0100 Subject: [PATCH] Be silent in case of lack of pep8 module --- ftplugin/python/pep8_fn.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ftplugin/python/pep8_fn.py b/ftplugin/python/pep8_fn.py index 32218e8..54d504c 100644 --- a/ftplugin/python/pep8_fn.py +++ b/ftplugin/python/pep8_fn.py @@ -4,7 +4,7 @@ Get pep8 output on current vim buffer using pep8.Checker object try: import pep8 except ImportError: - raise AssertionError('Error: pep8_fn.vim requires module pep8') + pep8 = None import vim @@ -24,6 +24,10 @@ class VImPep8(object): def run(self): """Run the checker""" + if not pep8: + vim.command("echo 'Error: pep8_fn.vim requires module pep8'") + return + pep8.process_options(['-r', vim.current.buffer.name]) checker = pep8.Checker(vim.current.buffer.name) checker.report_error = self.reporter