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.

2 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:
2

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

except AttributeError:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Maya Lin-Takahashi

Maya Lin-Takahashi

Consumer Tech & Gadget Reviewer

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.

Share this article
Twitter Facebook Pinterest