diff --git a/AnkiConnect.py b/AnkiConnect.py index 3e4b050..c82b098 100644 --- a/AnkiConnect.py +++ b/AnkiConnect.py @@ -1,5 +1,4 @@ -# Copyright (C) 2016 Alex Yatskov -# Author: Alex Yatskov +# Copyright 2016-2019 Alex Yatskov # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -346,12 +345,13 @@ class AnkiConnect: raise Exception('unsupported action') else: reply['result'] = methodInst(**params) + + if version <= 4: + reply = reply['result'] + except Exception as e: reply['error'] = str(e) - if version <= 4: - reply = reply['result'] - if self.log is not None: self.log.write('[reply]\n') json.dump(reply, self.log, indent=4, sort_keys=True)