Newbie help - Programming the Semantic Web with Python

Bruce Whealton bruce at
Sun Jul 10 03:32:00 CEST 2011

            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:
I tried to run 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 
>>>from simplegraph import SimpleGraph
That means it is going to look for a file named
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?


Bruce Whealton, Owner Future Wave Designs



Web Design and Development

Web Technology wiki:


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wlEmoticon-smile[1].png
Type: image/png
Size: 1041 bytes
Desc: not available
URL: <>

More information about the Python-list mailing list