2

I'm reading, and trying the exercises in Programming Collective Intelligence, from O'reilly. And in chapter two it's to work with pydelicicous API, and I follow the instruction to get it, but when I run the setup.py file, the following error appears:

File ".../pydelicious-0.7/setup.py", line 6, in <module> import pydelicious
File ".../pydelicious-0.7/pydelicious/__init__.py", line 228

raise PyDeliciousUnauthorized, "Check credentials."
                             ^
SyntaxError: invalid syntax

I wonder if this is because the book is quite old, and this API is out of use, or I'm doing something wrong... If someone could help me I would be very grateful, since it's not very useful to follow the book without trying the code.

I'm using python 3.6 and the link for the API is: https://code.google.com/archive/p/pydelicious/source

Haldean Brown
  • 12,411
  • 5
  • 43
  • 58
Guilherme
  • 135
  • 1
  • 1
  • 6
  • Welcome to SO! It might be helpful to add the code snippet that causes the error. Most readers won't be able to look into the book so they don't know what code your are talking about... – Michael Lihs Jan 18 '17 at 21:17
  • This error is because that code was written for python 2 and the raise syntax changes for python3. http://python-future.org/compatible_idioms.html#raising-exceptions I recommend you use python 2.7 for this code. – Onzalo Jan 18 '17 at 22:02

0 Answers0