catch exception if the file doesnt exist
This commit is contained in:
parent
c3e4f97d87
commit
7b8c5c892a
1 changed files with 4 additions and 3 deletions
|
@ -60,9 +60,9 @@ class _state:
|
||||||
|
|
||||||
def _load(data):
|
def _load(data):
|
||||||
global _data
|
global _data
|
||||||
file = open(os.environ['HOME']+'/.openbox/'+FILENAME+"."+str(data.screen),
|
try:
|
||||||
'r')
|
file = open(os.environ['HOME'] + '/.openbox/' + FILENAME+"." +
|
||||||
if file:
|
str(data.screen), 'r')
|
||||||
# read data
|
# read data
|
||||||
for line in file.readlines():
|
for line in file.readlines():
|
||||||
line = line[:-1] # drop the '\n'
|
line = line[:-1] # drop the '\n'
|
||||||
|
@ -78,6 +78,7 @@ def _load(data):
|
||||||
except ValueError: pass
|
except ValueError: pass
|
||||||
except IndexError: pass
|
except IndexError: pass
|
||||||
file.close()
|
file.close()
|
||||||
|
except IOError: pass
|
||||||
|
|
||||||
def _save(data):
|
def _save(data):
|
||||||
global _data
|
global _data
|
||||||
|
|
Loading…
Reference in a new issue