Streaming not work and no error message



I am new in this web site, I have a university projecte I want to stream tweet for Algerien peaples.

I used the following code to stream tweets as a primary step, but I get no thing whith this code, please what is wrong whith my code can you help me

in commande line I do python > test.txt

it give me no error but the test.txt is empty

i use ubuntu and python 2.7

thank a lot

from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream

consumer_key = ’ '
consumer_secret = ’ ’

access_token = ’ ‘
access_token_secret=’ ’

class StdOutListener(StreamListener):

def on_data(self, data):
        print (data)
        return True

def on_error(self, status):
    print (status)

if name == ‘main’:
l = StdOutListener()
auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)

stream = Stream(auth, l)


You are streaming Tweets with the word “algerie” in the Tweet text. You most likely want to remove the track parameter and use the locations parameter.

See the documentation on defining a location with lat log: