jon141
jon141

Reputation: 53

unexpected indent frustration

I have searched "unexpected indent" the error is pretty self explanatory but for the life of me i can't negotiate it, i've been trying for a day or so and getting nowhere !

the code:

    def scrape(url):
    N=10
    for i in range(N+1):
        try:
            return scraperwiki.scrape(url, user_agent="Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:16.0.1) Gecko/20121011 Firefox/16.0.1")
        except: Exception, e
            print "Failed to fetch", url, e
            print "Retry", i
            if i==N:
                raise

the error is on the line beginning

        print "Failed to fetch", url, e

can anyone shed some light on this please ? i just can't see it.

Upvotes: -1

Views: 152

Answers (1)

sshashank124
sshashank124

Reputation: 32189

Your exceptions should be before the :

except Exception, e:

Also, you should do this instead as per the changes:

except Exception as e:

Upvotes: 3

Related Questions