Terminate python based on printed output -


in here, limit tweepy stream specific number, tried stop streaming script using tweepy kept getting error. tried fixing error people may have suggested no luck.

i thought of method of possibly terminating script based on number of printed outputs. did take previous code , put function:

def streamer(location):     ## same code here ##     twitterstream.filter(locations=[\location) ## changed match function## 

then call function (i.e. streamer(la)) la predefined set of coordinates.

my question: possible terminate function streamer based on number outputs without changing function (due persisting error)?

you use quit() terminates whole session.

you need add streamdata variable somewhere. if correct constant stream of json items, add them list , use length of list. use twitterstream.disconnect() if got amount of outputs.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -