Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
umr-tetis
MOOD
mood-tetis-tweets-collect
Commits
60b7b95d
Commit
60b7b95d
authored
Jun 09, 2020
by
Rémy Decoupes
Browse files
add try catch around save file
parent
472e319d
Changes
1
Hide whitespace changes
Inline
Side-by-side
collectTweets.py
View file @
60b7b95d
...
...
@@ -61,10 +61,14 @@ class Listener(tweepy.StreamListener):
self
.
logger
.
info
(
"initiate stream listener"
)
def
on_status
(
self
,
status
):
print
(
status
.
_json
,
file
=
self
.
output_file
)
try
:
print
(
status
.
_json
,
file
=
self
.
output_file
)
except
:
msg
=
"can not save tweets in file"
+
str
(
self
.
output_file
)
exitscript
(
logger
,
msg
)
def
on_error
(
self
,
status_code
):
logger
.
error
(
"Error on stream twiter: "
+
str
(
status_code
))
logger
.
error
(
"Error on stream twit
t
er: "
+
str
(
status_code
))
return
False
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment