Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise ValueError when user selects incopatable formats #190

Open
nicholascar opened this issue Jan 12, 2022 · 3 comments
Open

Raise ValueError when user selects incopatable formats #190

nicholascar opened this issue Jan 12, 2022 · 3 comments

Comments

@nicholascar
Copy link
Member

This code fails because RDF is not a valid response format for a SELECT query:

from SPARQLWrapper import SPARQLWrapper, RDF, JSON, XML
sparql = SPARQLWrapper('http://ja.dbpedia.org/sparql')
sparql.setQuery('select * where { ?x ?y ?z. } limit 1')
sparql.setReturnFormat(RDF)
results = sparql.query().convert()

The code should not fail but should raise a ValueError Exception and explain why.

@nicholascar nicholascar changed the title Rais ValueError when user selects incopatable formats Raise ValueError when user selects incopatable formats Jan 12, 2022
@nicholascar
Copy link
Member Author

@eggplants this is just re-issuing your Issue with better scope for resolution.

@dgupta04
Copy link

@nicholascar Hi, here as a first time contributor! I tried my hands on this issue and am submitting a PR that solves it. Request you to please review it and share your thoughts on the same! Thanks!

@ananya2711
Copy link

Pull request added #218 with the required changes as discussed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants