mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-24 04:05:39 +01:00
parser.readconfig: handle permission denied while reading config
This commit is contained in:
parent
884ad99f9f
commit
772670b6c9
@ -1,6 +1,7 @@
|
||||
import argparse
|
||||
import platform
|
||||
import os
|
||||
import logging
|
||||
|
||||
from yaml import safe_load
|
||||
|
||||
@ -274,9 +275,12 @@ def readconfig(config, configfile, service=None, preset=None):
|
||||
global configdata
|
||||
|
||||
if configfile and configdata is None:
|
||||
with open(configfile) as fd:
|
||||
data = fd.read()
|
||||
configdata = safe_load(data)
|
||||
try:
|
||||
with open(configfile) as fd:
|
||||
data = fd.read()
|
||||
configdata = safe_load(data)
|
||||
except PermissionError:
|
||||
logging.error("Permission denied while reading config: {}".format(configfile))
|
||||
|
||||
if configdata is None:
|
||||
return config
|
||||
|
Loading…
Reference in New Issue
Block a user