# Buggy code
def __init__(self, parent=None):
    QPlainTextEdit.__init__(self, parent)
    BaseEditMixin.__init__(self)
    self.setAttribute(Qt.WA_DeleteOnClose)

    self.extra_selections_dict = {}

    self.textChanged.connect(self.changed)
    self.cursorPositionChanged.connect(self.cursor_position_changed)

    self.indent_chars = " " * 4
    self.tab_stop_width_spaces = 4

    # Code completion / calltips
    if parent is not None:
        mainwin = parent
        while not isinstance(mainwin, QMainWindow):
            mainwin = mainwin.parent()
            if mainwin is None:
                break
        if mainwin is not None:
            parent = mainwin

    self.completion_widget = CompletionWidget(self, parent)
    self.codecompletion_auto = False
    self.setup_completion()

    self.calltip_widget = CallTipWidget(self, hide_timer_on=False)
    self.calltip_position = None
    self.tooltip_widget = ToolTipWidget(self, as_tooltip=True)

    self.highlight_current_cell_enabled = False

    # The color values may be overridden by the syntax highlighter
    # Highlight current line color
    self.currentline_color = QColor(Qt.red).lighter(190)
    self.currentcell_color = QColor(Qt.red).lighter(194)

    # Brace matching
    self.bracepos = None
    self.matched_p_color = QColor(Qt.green)
    self.unmatched_p_color = QColor(Qt.red)

    self.last_cursor_cell = None

    self.decorations = TextDecorationsManager(self)


# Traceback (RuntimeError)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2551, in run_cell
self._run_cell_text(text, block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2614, in _run_cell_text
cell_name = self._get_cell_name(block)
File "C:\Users\Chan Chak Tong\Anaconda3\lib\site-packages\spyder\plugins\editor\widgets\editor.py", line 2595, in _get_cell_name
raise RuntimeError('Not a cell?')
RuntimeError: Not a cell?
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

# Fixed code
def __init__(self, parent=None):
    QPlainTextEdit.__init__(self, parent)
    BaseEditMixin.__init__(self)
    self.setAttribute(Qt.WA_DeleteOnClose)

    self.extra_selections_dict = {}

    self.textChanged.connect(self.changed)
    self.cursorPositionChanged.connect(self.cursor_position_changed)

    self.indent_chars = " " * 4
    self.tab_stop_width_spaces = 4

    # Code completion / calltips
    if parent is not None:
        mainwin = parent
        while not isinstance(mainwin, QMainWindow):
            mainwin = mainwin.parent()
            if mainwin is None:
                break
        if mainwin is not None:
            parent = mainwin

    self.completion_widget = CompletionWidget(self, parent)
    self.codecompletion_auto = False
    self.setup_completion()

    self.calltip_widget = CallTipWidget(self, hide_timer_on=False)
    self.calltip_position = None
    self.tooltip_widget = ToolTipWidget(self, as_tooltip=True)

    self.highlight_current_cell_enabled = False

    # The color values may be overridden by the syntax highlighter
    # Highlight current line color
    self.currentline_color = QColor(Qt.red).lighter(190)
    self.currentcell_color = QColor(Qt.red).lighter(194)

    # Brace matching
    self.bracepos = None
    self.matched_p_color = QColor(Qt.green)
    self.unmatched_p_color = QColor(Qt.red)

    self.decorations = TextDecorationsManager(self)