You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File "~/stream.py", line 18, in init
self.limit = int(numtweets)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
It seems that -n parameter is mandatory for stream.py, see line 18 below
Chapter 4 - Getting Twitter data into Kafka - TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
When executing following cli command (chapter 4 page 116)
python3 ~/stream.py -j | ./kafka-console-producer.sh --broker-list localhost:9092 --topic tweets
Following error is generated
File "~/stream.py", line 18, in init
self.limit = int(numtweets)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
It seems that -n parameter is mandatory for stream.py, see line 18 below
18--> self.limit = int(numtweets)
No error is generated when -n parameter is set
python3 ~/stream.py -j -n 1000 | ./kafka-console-producer.sh --broker-list localhost:9092 --topic tweets
Any workaround/solution possible ? Thanks.
stream.py
-- coding: utf-8 --
import tweepy
import os
import json
import argparse
consumer_key = os.environ['TWITTER_CONSUMER_KEY']
consumer_secret = os.environ['TWITTER_CONSUMER_SECRET']
access_key = os.environ['TWITTER_ACCESS_KEY']
access_secret = os.environ['TWITTER_ACCESS_SECRET']
class EchoStreamListener(tweepy.StreamListener):
def init(self, api, dump_json=False, numtweets=0):
self.api = api
self.dump_json = dump_json
self.count = 0
18--> self.limit = int(numtweets)
super(tweepy.StreamListener, self).init()
[snip]
The text was updated successfully, but these errors were encountered: