Alex Amaguaya
Alex Amaguaya

Reputation: 21

Cannot import name 'StreamListener' from Tweepy

I was trying to run a Listening in Tw, but when I run my test_listening.py script, it shows the following error.

> Traceback (most recent call last):   File "test_listening.py", line 1,
> in <module>
>     from tweepy.streaming import StreamListener ImportError: cannot import name 'StreamListener' from 'tweepy.streaming'
> (/home/user/.local/lib/python3.8/site-packages/tweepy/streaming.py)

I upgraded the Tweepy library, but it didn't work.

Upvotes: 1

Views: 2423

Answers (1)

Harmon758
Harmon758

Reputation: 5157

Tweepy v4.0.0 merged StreamListener into Stream.
I recommend updating your code to subclass Stream instead.
Alternatively, you can downgrade to v3.10.0.

Upvotes: 1

Related Questions