From 499a8f5f75e68befc87b23082292637aad0fcbe5 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 23 Feb 2020 19:46:24 +0100 Subject: Fix namespace add operator with Python 2 In Python 2, a __coerce__ attribute of the Namespace is requested in this case, which ends up producing an error. Work around this by defining a __coerce__ method that does nothing so __getattr__ is not called for it. --- bindings/python/lilv.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'bindings') diff --git a/bindings/python/lilv.py b/bindings/python/lilv.py index ffea115..45b8e05 100644 --- a/bindings/python/lilv.py +++ b/bindings/python/lilv.py @@ -1152,6 +1152,9 @@ class Namespace: def __str__(self): return self.prefix + def __coerce__(self, ignored): + return None + def __getattr__(self, suffix): return self.world.new_uri(self.prefix + suffix) -- cgit v1.2.1