Advice please :)
When I use this script:
class CustomStreamListener(tweepy.StreamListener):
def on_status(self, status):
# We\'ll simpl
Your example appears to be from here. And you are using Tweepy, a Python library for accessing the Twitter API.
From Github, here is the definition of a Stream()
object (assuming you have the latest version of Tweepy, please double check!),
def __init__(self, auth, listener, **options):
self.auth = auth
self.listener = listener
self.running = False
self.timeout = options.get("timeout", 300.0)
self.retry_count = options.get("retry_count")
self.retry_time = options.get("retry_time", 10.0)
self.snooze_time = options.get("snooze_time", 5.0)
self.buffer_size = options.get("buffer_size", 1500)
if options.get("secure"):
self.scheme = "https"
else:
self.scheme = "http"
self.api = API()
self.headers = options.get("headers") or {}
self.parameters = None
self.body = None
Because you seemed to have passed in the appropriate number of arguments, it looks like CustomStreamListener()
isn't being initialized, and therefore isn't being passed to the Stream()
class as an argument. See if you can initialize a CustomStreamListener()
prior to being passed as an argument to Stream()
.
The main reason of this issue is using the older version of tweepy. I was using tweepy 1.7.1 and having the same error before I updated tweepy 1.8. Right after that, the issue was solved. I think the 4 voted answer should be accepted answer to clarify the solution.
__init__
is the constructor of a class, in this case Stream
. The error means you have provided a wrong number of arguments to the constructor call.