From 4705a302fecee356b3c7bc49910d063016ae9bc1 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Thu, 27 Sep 2018 16:29:21 +0200 Subject: [PATCH] Clarify missing-property error message. The error message is modelled like CPython's normal AttributeError message ('foo' object has no attribute 'bar'). --- lib/matplotlib/artist.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/artist.py b/lib/matplotlib/artist.py index bb2a2de6b0e9..799cc0cd93f8 100644 --- a/lib/matplotlib/artist.py +++ b/lib/matplotlib/artist.py @@ -965,7 +965,8 @@ def _update_property(self, k, v): else: func = getattr(self, 'set_' + k, None) if not callable(func): - raise AttributeError('Unknown property %s' % k) + raise AttributeError('{!r} object has no property {!r}' + .format(type(self).__name__, k)) return func(v) with cbook._setattr_cm(self, eventson=False):