OSDN Git Service

Reduce traceback.
[fukui-no-namari/fukui-no-namari.git] / src / FukuiNoNamari / BbsType / bbs_type_other.py
index 0725adc..5398d86 100644 (file)
@@ -25,11 +25,16 @@ from bbs_type_exception import BbsTypeError
 _whitelist = []
 
 whitelist_path = os.path.expanduser("~/.fukui-no-namari/whitelist")
-try:
-    for line in file(whitelist_path):
-        _whitelist.append(line.rstrip())
-except IOError:
-    traceback.print_exc()
+
+def whitelist_load():
+    try:
+        for line in file(whitelist_path):
+            _whitelist.append(line.rstrip())
+    except IOError, e:
+        if e.errno != 2:
+            traceback.print_exc()
+
+whitelist_load()
 
 _board_reg_expr = re.compile("http://(?P<host>.+)/(?P<board>[^/]+)(?:/[^/]*){0,1}$")