RDFLib / sparqlwrapper

A wrapper for a remote SPARQL endpoint
https://sparqlwrapper.readthedocs.io/
Other
513 stars 121 forks source link

ConnectionResetError: [WinError 10054] The remote host forcibly closed an existing connection. #145

Closed cdhx closed 4 years ago

cdhx commented 4 years ago

hi i just run the example code,and got this error

ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接。 (in English : ConnectionResetError: [WinError 10054] The remote host forcibly closed an existing connection.)

this is my code,exactly same as the example ` from SPARQLWrapper import SPARQLWrapper, JSON

sparql = SPARQLWrapper("http://dbpedia.org/sparql") sparql.setQuery(""" PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema# SELECT ?label WHERE { http://dbpedia.org/resource/Asturias rdfs:label ?label } """) sparql.setReturnFormat(JSON) results = sparql.query().convert()

for result in results["results"]["bindings"]: print(result["label"]["value"])

print('---------------------------')

for result in results["results"]["bindings"]: print('%s: %s' % (result["label"]["xml:lang"], result["label"]["value"]))`

dayures commented 4 years ago

Hi,

just tested on python2.7 and python 3.6 and it looks like it is working fine. Could you try again ? Maybe it could be an issue with the network.

cdhx commented 4 years ago

ok i find the reason it is just the website's problem,the package works fine on other endpoint i tried to requests DBpedia,but it usually cannot response me,but if i requests local endpoint create by my self, it works fine besides, if anybody have more stable way to requests DBpedia dataset, please tell me, org‘s connection and speed is very bad(maybe it is just my VPN's problem)