eric6/Sessions/SessionFile.py

changeset 8240
93b8a353c4bf
parent 8218
7c09585bd960
equal deleted inserted replaced
8239:59a9a658618c 8240:93b8a353c4bf
224 224
225 try: 225 try:
226 jsonString = json.dumps(sessionDict, indent=2) 226 jsonString = json.dumps(sessionDict, indent=2)
227 with open(filename, "w") as f: 227 with open(filename, "w") as f:
228 f.write(jsonString) 228 f.write(jsonString)
229 except (TypeError, EnvironmentError) as err: 229 except (TypeError, OSError) as err:
230 with E5OverridenCursor(): 230 with E5OverridenCursor():
231 E5MessageBox.critical( 231 E5MessageBox.critical(
232 None, 232 None,
233 self.tr("Save Session"), 233 self.tr("Save Session"),
234 self.tr( 234 self.tr(
251 """ 251 """
252 try: 252 try:
253 with open(filename, "r") as f: 253 with open(filename, "r") as f:
254 jsonString = f.read() 254 jsonString = f.read()
255 sessionDict = json.loads(jsonString) 255 sessionDict = json.loads(jsonString)
256 except (EnvironmentError, json.JSONDecodeError) as err: 256 except (OSError, json.JSONDecodeError) as err:
257 E5MessageBox.critical( 257 E5MessageBox.critical(
258 None, 258 None,
259 self.tr("Read Session"), 259 self.tr("Read Session"),
260 self.tr( 260 self.tr(
261 "<p>The session file <b>{0}</b> could not be read.</p>" 261 "<p>The session file <b>{0}</b> could not be read.</p>"

eric ide

mercurial