diff --git a/rdflib/namespace.py b/rdflib/namespace.py index fc7985fa4..8228a0e03 100644 --- a/rdflib/namespace.py +++ b/rdflib/namespace.py @@ -798,6 +798,9 @@ def bind(self, prefix, namespace, override=True, replace=False): # When documenting explain that override only applies in what cases if prefix is None: prefix = "" + elif " " in prefix: + raise KeyError("Prefixes may not contain spaces.") + bound_namespace = self.store.namespace(prefix) # Check if the bound_namespace contains a URI # and if so convert it into a URIRef for comparison