]> Dogcows Code - chaz/openbox/commitdiff
catch exception if the file doesnt exist
authorDana Jansens <danakj@orodu.net>
Thu, 6 Feb 2003 15:17:50 +0000 (15:17 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 6 Feb 2003 15:17:50 +0000 (15:17 +0000)
scripts/historyplacement.py

index 815b31cbd8319fc39bbd4d0ea54283c618347566..6ce5dff54f8622f2c94307e6accb48729c38e96a 100644 (file)
@@ -60,9 +60,9 @@ class _state:
 
 def _load(data):
     global _data
-    file = open(os.environ['HOME']+'/.openbox/'+FILENAME+"."+str(data.screen),
-                'r')
-    if file:
+    try:
+        file = open(os.environ['HOME'] + '/.openbox/' + FILENAME+"." +
+                    str(data.screen), 'r')
         # read data
         for line in file.readlines():
             line = line[:-1] # drop the '\n'
@@ -78,6 +78,7 @@ def _load(data):
             except ValueError: pass
             except IndexError: pass
         file.close()
+    except IOError: pass
 
 def _save(data):
     global _data
This page took 0.027116 seconds and 4 git commands to generate.