Commit 9f428b6f011b440b2b3f314009f353b7f65f0f6f

Authored by tatiana
1 parent 55e04e1f

FIX: Problem while trying to save config but it doesn't exist

Showing 1 changed file with 8 additions and 2 deletions   Show diff stats
invesalius/session.py
@@ -211,6 +211,7 @@ class WriteSession(Thread): @@ -211,6 +211,7 @@ class WriteSession(Thread):
211 self.runing = 0 211 self.runing = 0
212 212
213 def Write(self): 213 def Write(self):
  214 + import utils as utl
214 215
215 config = ConfigParser.RawConfigParser() 216 config = ConfigParser.RawConfigParser()
216 217
@@ -230,8 +231,13 @@ class WriteSession(Thread): @@ -230,8 +231,13 @@ class WriteSession(Thread):
230 231
231 path = os.path.join(self.session.homedir , 232 path = os.path.join(self.session.homedir ,
232 '.invesalius', 'config.cfg') 233 '.invesalius', 'config.cfg')
233 - configfile = open(path, 'wb')  
234 - config.write(configfile) 234 + try:
  235 + configfile = open(path, 'wb')
  236 + except IOError:
  237 + return
  238 + utl.debug("Session - IOError")
  239 + else:
  240 + config.write(configfile)
235 configfile.close() 241 configfile.close()
236 242
237 243