176 if not res: |
176 if not res: |
177 return |
177 return |
178 fname = Utilities.toNativeSeparators(fname) |
178 fname = Utilities.toNativeSeparators(fname) |
179 |
179 |
180 try: |
180 try: |
181 f = open(fname, "w", encoding="utf-8") |
181 with open(fname, "w", encoding="utf-8") as f: |
182 itm = self.topLevelItem(0) |
182 itm = self.topLevelItem(0) |
183 while itm is not None: |
183 while itm is not None: |
184 f.write("{0}\n".format(itm.text(0))) |
184 f.write("{0}\n".format(itm.text(0))) |
185 f.write(78 * "=" + "\n") |
185 f.write(78 * "=" + "\n") |
186 itm = self.itemBelow(itm) |
186 itm = self.itemBelow(itm) |
187 f.close() |
|
188 except IOError as err: |
187 except IOError as err: |
189 E5MessageBox.critical( |
188 E5MessageBox.critical( |
190 self, |
189 self, |
191 self.tr("Error saving Call Stack Info"), |
190 self.tr("Error saving Call Stack Info"), |
192 self.tr("""<p>The call stack info could not be""" |
191 self.tr("""<p>The call stack info could not be""" |