[pitivi/gtktimeline] settings: Fix handling of OSError
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi/gtktimeline] settings: Fix handling of OSError
- Date: Wed, 6 May 2015 11:13:20 +0000 (UTC)
commit e7b603924f5a0148bdd9550dc08b22983cfdf019
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Wed May 6 10:18:30 2015 +0200
settings: Fix handling of OSError
pitivi/settings.py | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/settings.py b/pitivi/settings.py
index 84a524f..d85cfac 100644
--- a/pitivi/settings.py
+++ b/pitivi/settings.py
@@ -230,11 +230,10 @@ class GlobalSettings(GObject.Object):
else:
self._config.remove_option(section, key)
try:
- file = open(conf_file_path, 'w')
- except IOError as OSError:
+ with open(conf_file_path, 'w') as file:
+ self._config.write(file)
+ except (IOError, OSError):
return
- self._config.write(file)
- file.close()
def storeSettings(self):
"""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]