'Pyparsing ParseException

I am tring to insert the following SPARQL query:

sparql_3 = "INSERT {http://www.semanticweb.org/umbcknacc/ontologies/2017/10/untitled-ontology-3#Elizabeth http://www.semanticweb.org/umbcknacc/ontologies/2017/10/untitled-ontology-3#Allergies "+ repr(final_data) + "} WHERE {http://www.semanticweb.org/umbcknacc/ontologies/2017/10/untitled-ontology-3#Elizabeth ?predicate ?object .}"

final_data is a string variable that represents an encrypted data.

The print of the query is :

sparql_3 :: INSERT {http://www.semanticweb.org/umbcknacc/ontologies/2017/10/untitled-ontology-3#Elizabeth http://www.semanticweb.org/umbcknacc/ontologies/2017/10/untitled-ontology-3#Allergies '}c£¨\x0bÆpì\x9b]UÖIú\x86_ \x0f7Ò¼$K5eÅÔ4#\x8a3\x8fÏYï\x02ñTÂä\x15\x00°±ÐF!-'} WHERE {http://www.semanticweb.org/umbcknacc/ontologies/2017/10/untitled-ontology-3#Elizabeth ?predicate ?object .}

I was trying to run

qres_3 = g.update(sparql_3)

I get the following error:

pyparsing.ParseException: Expected end of text, found 'I' (at char 0), (line:1, col:1)

Can someone please help?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source