Remove IOError catch

merge-requests/64/head
Huluti 2016-12-04 19:32:11 +01:00
parent 989a5eafd5
commit 1eb6c9ed51
1 changed files with 6 additions and 6 deletions

View File

@ -63,13 +63,13 @@ class ManjaroHello(Gtk.Window):
try: try:
shutil.copyfile("manjaro-hello.desktop", self.autostart_path) shutil.copyfile("manjaro-hello.desktop", self.autostart_path)
self.preferences["autostart"] = True self.preferences["autostart"] = True
except (IOError, OSError) as e: except OSError as e:
print(e) print(e)
elif not state and os.path.exists(self.autostart_path): elif not state and os.path.exists(self.autostart_path):
try: try:
os.remove(self.autostart_path) os.remove(self.autostart_path)
self.preferences["autostart"] = False self.preferences["autostart"] = False
except (IOError, OSError) as e: except OSError as e:
print(e) print(e)
self.save_preferences() self.save_preferences()
@ -77,14 +77,14 @@ class ManjaroHello(Gtk.Window):
try: try:
with open(self.preferences_path, "w") as f: with open(self.preferences_path, "w") as f:
json.dump(self.preferences, f) json.dump(self.preferences, f)
except (IOError, OSError) as e: except OSError as e:
print(e) print(e)
def get_preferences(self): def get_preferences(self):
try: try:
with open(self.preferences_path, "r") as f: with open(self.preferences_path, "r") as f:
return json.load(f) return json.load(f)
except (IOError, OSError) as e: except OSError as e:
return None return None
def read_data(self, name): def read_data(self, name):
@ -95,7 +95,7 @@ class ManjaroHello(Gtk.Window):
try: try:
with open(filename, "r") as f: with open(filename, "r") as f:
return f.read() return f.read()
except (IOError, OSError) as e: except OSError as e:
return None return None
# Handlers # Handlers
@ -147,7 +147,7 @@ def get_lsb_information():
arg = arg[1:-1] arg = arg[1:-1]
if arg: if arg:
lsb[var] = arg lsb[var] = arg
except (IOError, OSError) as msg: except OSError as msg:
print(msg) print(msg)
return lsb return lsb