I had this problem. The other answer is actually correct, as it is almost certainly:
- Your program does not support thread
- You will receive a warning if this happens.
In my case, I read tweets in postgres for further analysis on a fairly dense geographical area, as well as keywords (in London, and about 100 keywords). It is possible that even if you simply print it, your local machine performs many other functions, and system processes become priority, so tweets will work until Twitter disconnects you. (This typically manifests itself as an obvious memory leak - the program increases in size until it is killed, or the twitter shuts down - whichever comes first.)
What made sense here was to push the processing into the queue. So I used the redis and django-rq solution - it took about 3 hours to deploy on dev and then on my production server, including researching, installing, re-creating existing code, stupid about my installation, testing and spelling errors, as I he went.
Now in your django directory (where ymmv is needed for direct python applications) do: python manage.py rqworker &
Now it's your turn! You can add tasks to it, for example, by changing your handler as follows: (At the top of the file)
import django_rq
Then in your handler section:
def on_data(self, data): django_rq.enqueue(print, data) return True
Aside - if you are interested in materials coming from Syria, instead of just mentioning Syria, you can add to the filter:
stream.filter(track=[t], locations=[35.6626, 32.7930, 42.4302, 37.2182]
This is a very crude geobox centered on Syria, but which will raise the Iraq / Turkey bit around the edges. Since this is an additional option, it is worth pointing out this:
Boundary fields do not act as filters for other filter parameters. For example, track = twitter & location = -122.75,36.8, -121.75,37.8 will correspond to any tweets containing the term Twitter (even non-geo-tweets) OR coming from the San Francisco area.
From this answer that helped me, and ditter .
Edit: from your subsequent posts, you can see that you continue to use the Twitter API, so hopefully you are sorted anyway, but hopefully it will be useful to someone else! :)