Newbie help - Programming the Semantic Web with Python

B

Bruce Whealton

Hello,
So, I got this book on Programming the Semantic Web about the same time I started learning Python. The code seems to be developed for python 2.7 and not 3, I believe. The code is here:
http://semprog.com/content/the-book/
I tried to run simpletriple.py from inside eclipse with PYDEV. The first thing it has a problem with is this line:
def add(self, (sub, pred, obj)):
I think the problem is with the parentheses before the sub. I removed those and that seemed to fix that error or make it go away. I don’t remember how I figured that out, It should be on the Errata page for sure.
Then it has a problem with this line:
print list(g.triples((None, None, None)))
If I was using python 3, it would require () around the thing that is going to be printed, right? Maybe python 2.7 doesn’t like this line for the same reason.

The book suggests that from IDLE, I can just use That means it is going to look for a file named simplegraph.py
but where will it be looking? I guess I would have to have it in the same folder as the python interpreter or one of the PATH directories, right?
Thanks,
Bruce

++++++++++++++++++++++++++++++++++++++++++++++++++

Bruce Whealton, Owner Future Wave Designs

FOAF: http://whealton.info/BruceWhealtonJr/foaf.rdf

Vcard: http://whealton.info/BruceWhealtonJr/brucewhealtonvcard.html

Web Design and Development http://FutureWaveDesigns.com

http://futurewavedesigns.com/wordpress/

Web Technology wiki: http://futurewavedesigns.com/w/

++++++++++++++++++++++++++++++++++++++++++++++++++
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top