-
-
Save acdha/4ba5286f9f872f771ea6 to your computer and use it in GitHub Desktop.
Failed attempts at loading RDFa data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(rdflib)cadams@Io:~/Desktop $ pip install 'rdflib<4' | |
Downloading/unpacking rdflib<4 | |
Using download cache from /tmp/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fr%2Frdflib%2Frdflib-3.4.0.tar.gz | |
… | |
(rdflib)cadams@Io:~/Desktop $ ./rdf-test.py 'http://www.bbc.co.uk/news/world-us-canada-22857062' 'http://oreilly.com/catalog/9780596804251/' | |
Loading 2 resources using rdflib 3.4.0 | |
Loading 'http://www.bbc.co.uk/news/world-us-canada-22857062' | |
ERROR: RDFa parsing Error! | |
Loading 'http://oreilly.com/catalog/9780596804251/' | |
ERROR: RDFa parsing Error! 'ascii' codec can't decode byte 0xc3 in position 7291: ordinal not in range(128) | |
(rdflib)cadams@Io:~/Desktop $ pip uninstall -y rdflib | |
Uninstalling rdflib: | |
Successfully uninstalled rdflib | |
(rdflib)cadams@Io:~/Desktop $ pip install 'rdflib' | |
Downloading/unpacking rdflib | |
Using download cache from /tmp/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fr%2Frdflib%2Frdflib-4.0.1.tar.gz | |
… | |
(rdflib)cadams@Io:~/Desktop $ ./rdf-test.py 'http://www.bbc.co.uk/news/world-us-canada-22857062' 'http://oreilly.com/catalog/9780596804251/' | |
Loading 2 resources using rdflib 4.0.1 | |
Loading 'http://www.bbc.co.uk/news/world-us-canada-22857062' | |
ERROR: RDFa parsing Error! | |
Loading 'http://oreilly.com/catalog/9780596804251/' | |
ERROR: RDFa parsing Error! 'ascii' codec can't decode byte 0xc3 in position 7291: ordinal not in range(128) | |
(rdflib)cadams@Io:~/Desktop $ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import rdflib | |
if len(sys.argv) < 2: | |
print >>sys.stderr, "Usage: %s url_or_file ..." % sys.argv[0] | |
sys.exit(1) | |
print "Loading %d resources using rdflib %s" % (len(sys.argv) - 1, rdflib.__version__) | |
for i in sys.argv[1:]: | |
print "Loading '%s'" % i | |
try: | |
g = rdflib.Graph() | |
g.parse(i) | |
print "... loaded %d records" % len(g) | |
except Exception as e: | |
print >>sys.stderr, "ERROR: %s" % e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment