'Save breakpoints when file is saved'

def store_file_breaks(self):

    breaks = self.breakpoints
    filename = self.io.filename
    try:
        with open(self.breakpointPath, 'r') as old_file:
            lines = old_file.readlines()
    except IOError:
        lines = []
    try:
        with open(self.breakpointPath, 'w') as new_file:
            for line in lines:
                if (not line.startswith((filename + '='))):
                    new_file.write(line)
            self.update_breakpoints()
            breaks = self.breakpoints
            if breaks:
                new_file.write((((filename + '=') + str(breaks)) + '\n'))
    except IOError as err:
        if (not getattr(self.root, 'breakpoint_error_displayed', False)):
            self.root.breakpoint_error_displayed = True
            tkMessageBox.showerror(title='IDLE    Error', message=('Unable    to    update    breakpoint    list:\n%s' % str(err)), parent=self.text)
