title: ValueError: Invalid \escape while running query
body: <p>I am trying to query DBpedia using SPARQLWrapper in Python (v3.3). This is my query:</p>
  
  <pre class="lang-none prettyprint-override"><code>PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
  SELECT ?slot WHERE {
    &lt;http://dbpedia.org/resource/Week&gt; &lt;http://www.w3.org/2002/07/owl#sameAs&gt; ?slot
  }
  </code></pre>
  
  <p>It results in an error from the SPARQLWrapper package:</p>
  
  <blockquote>
    <p>ValueError: Invalid \escape: line 118 column 74 (char 11126)</p>
  </blockquote>
  
  <p>Code: </p>
  
  <pre class="lang-none prettyprint-override"><code>query = "PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; SELECT ?slot WHERE{{ {subject} {predicate} {object} }} "
  
  query = query.format(subject=subject, predicate=predicate, object= objectfield)
          self.sparql.setQuery(query)
  
          self.sparql.setReturnFormat(JSON)
  
  
      results = self.sparql.query().convert() # Error thrown at this line 
  </code></pre>
  
  <p>Error : </p>
  
  <pre><code>Traceback (most recent call last):
    File "getUriLiteralAgainstPredicate.py", line 84, in &lt;module&gt;
      sys.exit(main())
    File "getUriLiteralAgainstPredicate.py", line 61, in main
      entity,predicateURI,result = p.getObject(dataAtURI,predicates, each["entity"])
    File "getUriLiteralAgainstPredicate.py", line 30, in getObject
      result = self.run_sparql("&lt;"+subjectURI+"&gt;","&lt;"+predicateURI+"&gt;","?slot")
    File "getUriLiteralAgainstPredicate.py", line 24, in run_sparql
      results = self.sparql.query().convert()
    File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/SPARQLWrapper-1.5.2-py3.3.egg/SPARQLWrapper/Wrapper.py", line 539, in convert
      return self._convertJSON()
    File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/SPARQLWrapper-1.5.2-py3.3.egg/SPARQLWrapper/Wrapper.py", line 476, in _convertJSON
      return jsonlayer.decode(self.response.read().decode("utf-8"))
    File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/SPARQLWrapper-1.5.2-py3.3.egg/SPARQLWrapper/jsonlayer.py", line 76, in decode
      return _decode(string)
    File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/SPARQLWrapper-1.5.2-py3.3.egg/SPARQLWrapper/jsonlayer.py", line 147, in &lt;lambda&gt;
      _decode = lambda string, loads=json.loads: loads(string)
    File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/json/__init__.py", line 319, in loads
      return _default_decoder.decode(s)
    File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/json/decoder.py", line 352, in decode
      obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/json/decoder.py", line 368, in raw_decode
      obj, end = self.scan_once(s, idx)
  ValueError: Invalid \escape: line 118 column 74 (char 11126)
  </code></pre>