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

Fix Graph.parse URL handling on windows #1441

Merged

Conversation

aucampia
Copy link
Member

Using pathlib.Path("http://example.com/").exists() on windows causes an exception as a URL
is not a valid path, while os.path.exists("http://example.com/") just
returns false.

This patch reverts _create_input_source_from_location to using
os.path.exists() instead of pathlib.Path to make it possible to parse
graphs from http URLs on windows.

Fixes #1430

Proposed Changes

  • use os.path.exists() instead of pathlib.Path().exists() as the former returns false for URLs on windows while the latter rasies an exception.

Using `pathlib.Path("http://example.com/").exists()` on windows causes an exception as a URL
is not a valid path, while `os.path.exists("http://example.com/")` just
returns false.

This patch reverts _create_input_source_from_location to using
`os.path.exists()` instead of pathlib.Path to make it possible to parse
graphs from http URLs on windows.
@nicholascar
Copy link
Member

I believe the PR authors and other contributors to #1430 that this fixes their issues and there are great tests, so I'm merging straight away.

@nicholascar nicholascar merged commit 204fea6 into RDFLib:master Oct 12, 2021
@aucampia aucampia deleted the iwana-20211012T1639-graph_parse_url branch November 17, 2021 19:32
aucampia added a commit to aucampia/rdflib that referenced this pull request Nov 28, 2021
test/jsonld/test_onedotone.py got a bit messed up with a merge from
master. Looking at the original changes from @ashleysommer, all he did
was change a condition. This applies the same change but essentially
rebased on master.

For comparison see: RDFLib/rdflib@ab31c5e...c4b679f

Also add back import os in rdflib/parser.py

This is now needed after RDFLib#1441 was
merged.
aucampia added a commit to aucampia/rdflib that referenced this pull request Nov 28, 2021
test/jsonld/test_onedotone.py got a bit messed up with a merge from
master. Looking at the original changes from @ashleysommer, all he did
was change a condition. This applies the same change but essentially
rebased on master.

For comparison see: RDFLib/rdflib@ab31c5e...c4b679f

Also add back import os in rdflib/parser.py

This is now needed after RDFLib#1441 was
merged.
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

Successfully merging this pull request may close these issues.

new version does not parse URL in windows
2 participants