'TweepError attribute error when using Tweepy

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.



Solution 1:[1]

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:

Solution 2:[2]

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

except AttributeError:

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Benjamin Breton