From ac5901ca20b39f8efd4702ed862f77b3acd2d3f2 Mon Sep 17 00:00:00 2001 From: v3aqb Date: Mon, 14 Oct 2013 20:14:59 +0800 Subject: [PATCH] fix bug when no config file exists --- shadowsocks/local.py | 3 +++ shadowsocks/server.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/shadowsocks/local.py b/shadowsocks/local.py index 3cbb28a..0731fc8 100755 --- a/shadowsocks/local.py +++ b/shadowsocks/local.py @@ -178,6 +178,9 @@ def main(): logging.info('loading config from %s' % config_path) with open(config_path, 'rb') as f: config = json.load(f) + else: + config = {} + optlist, args = getopt.getopt(sys.argv[1:], 's:b:p:k:l:m:c:6') for key, value in optlist: if key == '-p': diff --git a/shadowsocks/server.py b/shadowsocks/server.py index eaf37a1..c272bb8 100755 --- a/shadowsocks/server.py +++ b/shadowsocks/server.py @@ -153,6 +153,8 @@ def main(): with open(config_path, 'rb') as f: config = json.load(f) logging.info('loading config from %s' % config_path) + else: + config = {} optlist, args = getopt.getopt(sys.argv[1:], 's:p:k:m:c:6') for key, value in optlist: