TweepError attribute error when using Tweepy

Viewed 4828

I am getting an AttributeError: module 'tweepy' has no attribute 'TweepError'. Here is my relevant code in Python:

except tweepy.TweepError as e:
    msg = 'Query failed when max_id equaled {0}: {1}'.format(max_id, e)
    logging.error(msg)

my other code with tweepy is working so I'm sure I've installed it correctly, and it seems that tweep error is included in the current documentation.

3 Answers

The correct exception is tweepy.errors.TweepError, so change that line to:

except tweepy.errors.TweepError as e:

in older versions of Tweepy, it was previously:

except tweepy.error.TweepError as e:

except tweepy.errors.TweepyException as e:

I tried solutions above but as of 24th of May, this one works for me:

except AttributeError:
Related