开发者

TypeError: __init__() takes at least 4 non-keyword arguments (3 given) [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

TypeError: init() takes at least 4 non-keyword arguments (3 given)

When i use this script:

import sys, tweepy, webbrowser

Q = sys.argv[1:] 

class CustomStreamListener(tweepy.StreamListener):

    def on_status(self, status):       
        try:
            print "%s\t%s\t%s\t%s" % (status.text, 
                                      status.author.screen_name, 
                                      status.created_at, 
                                      status.source,)
        except Exception, e:
            print >> sys.stderr, 'Encountered Exception:', e
            pass
    def on_error(self, sta开发者_如何学Gotus_code):
        print >> sys.stderr, 'Encountered error with status code:', status_code
        return True # Don't kill the stream
    def on_timeout(self):
        print >> sys.stderr, 'Timeout...'
        return True 
streaming_api = tweepy.streaming.Stream(auth, CustomStreamListener(), timeout=60)

print >> sys.stderr, 'Filtering the public timeline for "%s"' % (' '.join(sys.argv[1:]),)

streaming_api.filter(follow=None, track=Q)

It comes error like this :

Traceback (most recent call last):
  File "C:/Python26/test.py", line 65, in <module>
    streaming_api = tweepy.streaming.Stream(auth, CustomStreamListener(), timeout=60)
TypeError: __init__() takes at least 4 non-keyword arguments (3 given)

What should I do ?


streaming_api = tweepy.streaming.Stream(auth, CustomStreamListener(), timeout=60)

in this line you need to change auth with username, password separately, or update to the last release of tweepy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜