mirror of
https://gitlab.com/jeancf/twoot.git
synced 2025-02-22 16:22:12 +00:00
Added exception handling
This commit is contained in:
parent
2ea843f3a7
commit
72e44d4f7e
6
twoot.py
6
twoot.py
|
@ -984,7 +984,11 @@ def main(argv):
|
||||||
# Open log file
|
# Open log file
|
||||||
log_file_name = TOML['config']['twitter_account'] + '.log'
|
log_file_name = TOML['config']['twitter_account'] + '.log'
|
||||||
new_log_file_name = TOML['config']['twitter_account'] + '.log.new'
|
new_log_file_name = TOML['config']['twitter_account'] + '.log.new'
|
||||||
log_file = open(log_file_name, 'r')
|
try:
|
||||||
|
log_file = open(log_file_name, 'r')
|
||||||
|
except FileNotFoundError:
|
||||||
|
# Nothing to do if there is no log file
|
||||||
|
terminate(0)
|
||||||
|
|
||||||
# Check each line
|
# Check each line
|
||||||
pos = log_file.tell()
|
pos = log_file.tell()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user