Newbie help - Programming the Semantic Web with Python

Discussion in 'Python' started by Bruce Whealton, Jul 10, 2011.

  1. 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
    >>>from simplegraph import SimpleGraph

    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/

    ++++++++++++++++++++++++++++++++++++++++++++++++++
     
    Bruce Whealton, Jul 10, 2011
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    391
  2. smonroe
    Replies:
    0
    Views:
    449
    smonroe
    Jul 28, 2006
  3. smonroe
    Replies:
    0
    Views:
    388
    smonroe
    Jul 28, 2006
  4. Sören Auer
    Replies:
    0
    Views:
    162
    Sören Auer
    Feb 4, 2005
  5. James G. Britt
    Replies:
    1
    Views:
    142
    James G. Britt
    Feb 7, 2005
Loading...

Share This Page