Commit 60b7b95d authored by Rémy Decoupes's avatar Rémy Decoupes
Browse files

add try catch around save file

parent 472e319d
...@@ -61,10 +61,14 @@ class Listener(tweepy.StreamListener): ...@@ -61,10 +61,14 @@ class Listener(tweepy.StreamListener):"initiate stream listener")"initiate stream listener")
def on_status(self, status): def on_status(self, status):
print(status._json, file=self.output_file) try:
print(status._json, file=self.output_file)
msg = "can not save tweets in file"+str(self.output_file)
exitscript(logger, msg)
def on_error(self, status_code): def on_error(self, status_code):
logger.error("Error on stream twiter: "+str(status_code)) logger.error("Error on stream twitter: "+str(status_code))
return False return False
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment