From 3ac3ee2186f31711dd21b0bc9d6f850995db35ed Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sun, 20 Oct 2019 16:26:00 -0400 Subject: [PATCH] Work around lack of f-strings in Python 3.5. This forwards the arguments and keywords to `str.format`. It's a good poor man's f-string, anyway... --- korman/exporter/explosions.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/korman/exporter/explosions.py b/korman/exporter/explosions.py index 48151e3..29102b1 100644 --- a/korman/exporter/explosions.py +++ b/korman/exporter/explosions.py @@ -23,8 +23,13 @@ class NonfatalExportError(Exception): class ExportError(Exception): - def __init__(self, value="Undefined Export Error"): - super(Exception, self).__init__(value) + def __init__(self, *args, **kwargs): + if not args: + super(Exception, self).__init__("Undefined Export Error") + elif len(args) > 1: + super(Exception, self).__init__(args[0].format(*args[1:], **kwargs)) + else: + super(Exception, self).__init__(args[0]) class BlenderOptionNotSupportedError(ExportError):