From a11f891010cce1f02b1270b6e55bbd41628b5b3e Mon Sep 17 00:00:00 2001 From: user202729 <25191436+user202729@users.noreply.github.com> Date: Mon, 13 May 2024 12:05:57 +0700 Subject: [PATCH] Show traceback from file on error --- plover_python_dictionary.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plover_python_dictionary.py b/plover_python_dictionary.py index f1727bb..90cdf36 100644 --- a/plover_python_dictionary.py +++ b/plover_python_dictionary.py @@ -20,7 +20,7 @@ def _load(self, filename): with open(filename, encoding='utf-8') as fp: source = fp.read() mod = {} - exec(source, mod) + exec(compile(source, filename, 'exec'), mod) longest_key = mod.get('LONGEST_KEY') if not isinstance(longest_key, int) or longest_key <= 0: raise ValueError('missing or invalid `LONGEST_KEY\' constant: %s\n' % longest_key)