user4315272
user4315272

Reputation: 143

How can I run python instagram sample app

I want to deal with instagram api, so I tried to handle it.

But when I run this code, it makes error

And this is an error message when I run it.

Traceback (most recent call last):
File "C:\Users\User\Desktop\Folder\sample_app.py", line 2, in <module>
import beaker.middleware
File "C:\Python34\lib\beaker\middleware.py", line 11, in <module>
from beaker.cache import CacheManager
File "C:\Python34\lib\beaker\cache.py", line 62
except KeyError, e:
               ^
SyntaxError: invalid syntax

I'm using version 3.4.2, and I already installed bottle, beaker, python-instagram, httplib2, simplejson, six by using pip.

Upvotes: 0

Views: 385

Answers (1)

Alex Martelli
Alex Martelli

Reputation: 881785

That app clearly requires Python 2.7, where the syntax is correct -- Python 3 requires an as in lieu of the comma.

As a programming beginner I would not recommend that you fight with a 2.7 to 3.4 migration -- even though 3.4 is a better language, for now just uninstall 3.4 and its appurtenances, install 2.7, go through the "install all the other pieces again", and despite these chores you should be much happier.

Sorry -- and I mean it personally. 13 years or so ago we couldn't get all details of Python 2 just right -- but had to keep supporting them for backwards compatibility... that's why there's a Python 2.7, heads and shoulders above our earliest 2.0, but still accepting wrong design decisions like that comma to keep old apps working!

A few years ago we (mostly our Benevolent Dictator For Life, Guido) decided it was time to get truly better and introduce a new version, originally tagged "Python 3K" (now just Python 3), able to introduce backwards incompatibility for the sake of improvement.

To help explain how we stand on that -- my friend Guido's red prius license says "PY3K". The red prius owned and operated by me and my wife (and Python book co-author) Anna has a license "P-heart-THON"...:-)

Hope these personalia help energize you through the chores ahead...!-)

Upvotes: 2

Related Questions