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 argparse
|
||||||
import platform
|
import platform
|
||||||
import os
|
import os
|
||||||
|
import logging
|
||||||
|
|
||||||
from yaml import safe_load
|
from yaml import safe_load
|
||||||
|
|
||||||
@ -274,9 +275,12 @@ def readconfig(config, configfile, service=None, preset=None):
|
|||||||
global configdata
|
global configdata
|
||||||
|
|
||||||
if configfile and configdata is None:
|
if configfile and configdata is None:
|
||||||
with open(configfile) as fd:
|
try:
|
||||||
data = fd.read()
|
with open(configfile) as fd:
|
||||||
configdata = safe_load(data)
|
data = fd.read()
|
||||||
|
configdata = safe_load(data)
|
||||||
|
except PermissionError:
|
||||||
|
logging.error("Permission denied while reading config: {}".format(configfile))
|
||||||
|
|
||||||
if configdata is None:
|
if configdata is None:
|
||||||
return config
|
return config
|
||||||
|
Loading…
Reference in New Issue
Block a user