'How should I fix " TypeError: __init__() missing 2 required positional arguments: 'access_token' and 'access_token_secret' "?

I am working with a Python script which fetches tweets from Twitter via tweepy API.

else:
        # create instance of the tweepy tweet stream listener
        tweetlistener = TweetStreamListener()

        # set twitter keys/tokens
        auth = OAuthHandler(consumer_key, consumer_secret)
        auth.set_access_token(access_token, access_token_secret)
        api = API(auth)

        # create instance of the tweepy stream
        stream = Stream(auth, tweetlistener)

Error:

Traceback (most recent call last):
 File "sentiment.py", line 895, in <module>
    stream = Stream(auth, tweetlistener)
TypeError: __init__() missing 2 required positional arguments: 'access_token' and 'access_token_secret'

The page I have referred: TypeError: __init__() missing 2 required positional arguments: 'access_token' and 'access_token_secret', It didn't helped much and I am still confused. What should I do?

Edit 1: When I hovered over TweetStreamListener() there is this info:

(class) TweetStreamListener()

__init__( consumer_key, consumer_secret, access_token, access_token_secret, chunk_size=512, daemon=False, max_retries=inf, proxy=None, verify=True )

So I think, this is where everything is getting messed up. What do you say about it?



Sources

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

Source: Stack Overflow

Solution Source