Permalink
Browse files

Patched lib/rdflib/plugins/parsers/pyRdfa/utils.py to prevent crachin…

…g in Windows dev environment.

Fix for issues (#142) and (#1184)
  • Loading branch information...
1 parent 77c45d0 commit df0d380947fadf62dcfe29436c1c7c69844107c3 @RichardWallis RichardWallis committed Oct 26, 2016
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/rdflib/plugins/parsers/pyRdfa/utils.py
@@ -72,6 +72,15 @@ def __init__(self, name, additional_headers = {}) :
@keyword additional_headers: additional HTTP request headers to be added to the call
"""
try :
+ import sys
+ import urllib
+
+ platform = sys.platform
+ if platform == 'Windows' or platform == 'win32' or platform == 'nt' or platform == 'win64':
+ # Running on Windows which doesn't like file URLs not prefixed with 'file:'
+ if not name.startswith('http://') and not name.startswith('https://'):
+ name = 'file:' + urllib.pathname2url(name)
+
# Note the removal of the fragment ID. This is necessary, per the HTTP spec
req = Request(url=name.split('#')[0])

1 comment on commit df0d380

@RichardWallis
Contributor
RichardWallis commented on df0d380 Oct 26, 2016 edited

Fix for issues (#1142) and (#1384)

Please sign in to comment.