Re: Prob. Code Downloaded for Programming the Semantic Web (python code)

2014-07-28 Thread Bruce Whealton
On Monday, July 28, 2014 11:28:40 AM UTC-4, Steven D'Aprano wrote: > On Mon, 28 Jul 2014 03:39:48 -0700, Bruce Whealton wrote: Stephen, I went to my Ubuntu box inside vmware and added a #!/usr/bin/env python2.7 to the top. Then I made the file executable and it ran the code perfectly. > >

Re: Prob. Code Downloaded for Programming the Semantic Web (python code)

2014-07-28 Thread Steven D'Aprano
On Mon, 28 Jul 2014 03:39:48 -0700, Bruce Whealton wrote: > I setup Eclipse to use python 2.7.x and tried to run this and it just > gave an error on line 9 where the def add function is declared. First step is to confirm that Eclipse actually is using Python 2.7. Can you get it to run this code

Re: Prob. Code Downloaded for Programming the Semantic Web (python code)

2014-07-28 Thread Bruce Whealton
On Friday, July 25, 2014 11:25:15 PM UTC-4, Chris Angelico wrote: > On Sat, Jul 26, 2014 at 10:06 AM, Bruce Whealton > Chris, In response to your comments below, I'm comfortable changing this to use python 3. > As others have said, this is something that changed in Python 3. So > you have two

Re: Prob. Code Downloaded for Programming the Semantic Web (python code)

2014-07-28 Thread Bruce Whealton
On Friday, July 25, 2014 9:28:32 PM UTC-4, Steven D'Aprano wrote: > On Fri, 25 Jul 2014 17:06:17 -0700, Bruce Whealton wrote: Steven, See below please. The explanation did help. > > > OK, Eclipse with PyDev doesn't like this first line, with the function: > > > def add(self, (sub, pred, obj))

Re: Prob. Code Downloaded for Programming the Semantic Web (python code)

2014-07-26 Thread Terry Reedy
On 7/25/2014 8:06 PM, Bruce Whealton wrote: The book has python 2.x code. If the modules in the book use the Natural Language Toolkit (nltk), then I believe you are currently stuck with using 2.7. If it does not, and you want to run with 3.3 or 3.4, then use 2to3 to do most to all of the con

Re: Prob. Code Downloaded for Programming the Semantic Web (python code)

2014-07-25 Thread Chris Angelico
On Sat, Jul 26, 2014 at 10:06 AM, Bruce Whealton wrote: > OK, Eclipse with PyDev doesn't like this first line, with the function: > def add(self, (sub, pred, obj)): As others have said, this is something that changed in Python 3. So you have two parts to the problem: firstly, your code is bound t

Re: Prob. Code Downloaded for Programming the Semantic Web (python code)

2014-07-25 Thread Steven D'Aprano
On Fri, 25 Jul 2014 17:06:17 -0700, Bruce Whealton wrote: > OK, Eclipse with PyDev doesn't like this first line, with the function: > def add(self, (sub, pred, obj)): In Python 2, you could include parenthesised parameters inside function declarations as above. That is effectively a short cut for

Re: Prob. Code Downloaded for Programming the Semantic Web (python code)

2014-07-25 Thread Ian Kelly
On Jul 25, 2014 6:54 PM, "Dan Stromberg" wrote: > > On Fri, Jul 25, 2014 at 5:21 PM, Skip Montanaro wrote: > >> OK, Eclipse with PyDev doesn't like this first line, with the function: > >> def add(self, (sub, pred, obj)): > >> > >> It complains about the parentheses just before sub. > > > > Seems

Re: Prob. Code Downloaded for Programming the Semantic Web (python code)

2014-07-25 Thread Dan Stromberg
On Fri, Jul 25, 2014 at 5:21 PM, Skip Montanaro wrote: >> OK, Eclipse with PyDev doesn't like this first line, with the function: >> def add(self, (sub, pred, obj)): >> >> It complains about the parentheses just before sub. > > Seems like this code is Python 2.x. For me, this code ran on all of 2

Re: Prob. Code Downloaded for Programming the Semantic Web (python code)

2014-07-25 Thread Skip Montanaro
> OK, Eclipse with PyDev doesn't like this first line, with the function: > def add(self, (sub, pred, obj)): > > It complains about the parentheses just before sub. Seems like this code is Python 2.x. Skip -- https://mail.python.org/mailman/listinfo/python-list

Prob. Code Downloaded for Programming the Semantic Web (python code)

2014-07-25 Thread Bruce Whealton
Hello all, I downloaded some code accompanying the book "Programming the Semantic Web." This question is not Semantic Web related and I doubt that one needs to know anything about the Semantic Web to help me with this. It's the first code sample in the book, I'm embarrassed to say. I