From 310f91ede783cd7838112f5d0df78f2548dbc3c3 Mon Sep 17 00:00:00 2001 From: Nova Date: Wed, 6 Sep 2017 12:06:31 -0400 Subject: [PATCH] throws exception instead of error if local database doesnt exist --- pirate/pirate.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pirate/pirate.py b/pirate/pirate.py index c159996..92071bf 100755 --- a/pirate/pirate.py +++ b/pirate/pirate.py @@ -52,17 +52,25 @@ def parse_config_file(text): return config - +print 'exist' def load_config(): # user-defined config files config_home = os.getenv('XDG_CONFIG_HOME', '~/.config') config = expanduser(os.path.join(config_home, 'pirate-get')) # read config file + if os.path.isfile(config): with open(config) as f: return parse_config_file(f.read()) + # sees if local database exsists + try: + os.path.isfile('/root/downloads/pirate-get/db') + + except FileNotFoundError: + return "piratebay local database does not exsist!" + return parse_config_file("")