From 8458017498b05fdfe78f003e26e04b02bf0c6402 Mon Sep 17 00:00:00 2001 From: wenxianping <931128603@qq.com> Date: Thu, 17 Jan 2019 15:33:10 +0800 Subject: [PATCH] fix --- agency/agency_tools.py | 2 +- agency/cdn_utils.py | 2 +- config/ticketConf.py | 2 +- init/select_ticket_info.py | 2 +- inter/GetPassCodeNewOrderAndLogin.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/agency/agency_tools.py b/agency/agency_tools.py index 5c88dc8..6868435 100755 --- a/agency/agency_tools.py +++ b/agency/agency_tools.py @@ -75,7 +75,7 @@ class proxy: for i in lins: p = i.strip("\n") self.proxy_filter_list.append(p) - except TypeError: + except Exception: with open(path, "r", ) as f: lins = f.readlines() for i in lins: diff --git a/agency/cdn_utils.py b/agency/cdn_utils.py index 4357afb..ca3c67d 100755 --- a/agency/cdn_utils.py +++ b/agency/cdn_utils.py @@ -74,7 +74,7 @@ class CDNProxy: if i and "kyfw.12306.cn:443" not in i: cdn.append(i.replace("\n", "")) return cdn - except TypeError: + except Exception: with open(path, "r") as f: for i in f.readlines(): # print(i.replace("\n", "")) diff --git a/config/ticketConf.py b/config/ticketConf.py index cdd51b5..8021737 100755 --- a/config/ticketConf.py +++ b/config/ticketConf.py @@ -15,7 +15,7 @@ def _get_yaml(): try: # 兼容2和3版本 with open(path, encoding="utf-8") as f: s = yaml.load(f) - except TypeError: + except Exception: with open(path) as f: s = yaml.load(f) return s.decode() if isinstance(s, bytes) else s diff --git a/init/select_ticket_info.py b/init/select_ticket_info.py index ff0ed64..3fc9374 100755 --- a/init/select_ticket_info.py +++ b/init/select_ticket_info.py @@ -140,7 +140,7 @@ class select: try: with open(path, encoding="utf-8") as result: info = result.read().split('=')[1].strip("'").split('@') - except TypeError: + except Exception: with open(path) as result: info = result.read().split('=')[1].strip("'").split('@') del info[0] diff --git a/inter/GetPassCodeNewOrderAndLogin.py b/inter/GetPassCodeNewOrderAndLogin.py index e708e77..6295bae 100644 --- a/inter/GetPassCodeNewOrderAndLogin.py +++ b/inter/GetPassCodeNewOrderAndLogin.py @@ -29,7 +29,7 @@ def getPassCodeNewOrderAndLogin(session, imgType): try: with open(img_path, 'wb', encoding="utf-8") as img: img.write(result) - except TypeError: + except Exception: with open(img_path, 'wb') as img: img.write(result) return result