# Buggy code
def __init__(self, title="napari", ndisplay=2, order=None, axis_labels=None):
    # instance() returns the singleton instance if it exists, or None
    app = QApplication.instance()
    # if None, raise a RuntimeError with the appropriate message
    if app is None:
        message = (
            "napari requires a Qt event loop to run. To create one, "
            "try one of the following: \n"
            "  - use the `napari.gui_qt()` context manager. See "
            "https://github.com/napari/napari/tree/master/examples for"
            " usage examples.\n"
            "  - In IPython or a local Jupyter instance, use the "
            "`%gui qt` magic command.\n"
            "  - Launch IPython with the option `--gui=qt`.\n"
            "  - (recommended) in your IPython configuration file, add"
            " or uncomment the line `c.TerminalIPythonApp.gui = 'qt'`."
            " Then, restart IPython."
        )
        raise RuntimeError(message)
    super().__init__(
        title=title,
        ndisplay=ndisplay,
        order=order,
        axis_labels=axis_labels,
    )
    qt_viewer = QtViewer(self)
    self.window = Window(qt_viewer)
    self.update_console = self.window.qt_viewer.console.push


# Traceback (AttributeError)
Traceback (most recent call last):

File "<ipython-input-48-ce4a0e063e17>", line 3, in <module>
napari.view_image(pyramid, is_pyramid=True)

File "C:\anaconda3\envs\nap\lib\site-packages\napari\view_layers.py", line 120, in view_image
path=path,

File "C:\anaconda3\envs\nap\lib\site-packages\napari\components\viewer_model.py", line 509, in add_image
visible=visible,

File "C:\anaconda3\envs\nap\lib\site-packages\napari\layers\image\image.py", line 147, in __init__
data, pyramid=is_pyramid, rgb=rgb

File "C:\anaconda3\envs\nap\lib\site-packages\napari\util\misc.py", line 143, in get_pyramid_and_rgb
init_shape = data.shape

AttributeError: 'list' object has no attribute 'shape'

# Fixed code
def __init__(self, title="napari", ndisplay=2, order=None, axis_labels=None):
    # instance() returns the singleton instance if it exists, or None
    app = QApplication.instance()
    # if None, raise a RuntimeError with the appropriate message
    if app is None:
        message = (
            "napari requires a Qt event loop to run. To create one, "
            "try one of the following: \n"
            "  - use the `napari.gui_qt()` context manager. See "
            "https://github.com/napari/napari/tree/master/examples for"
            " usage examples.\n"
            "  - In IPython or a local Jupyter instance, use the "
            "`%gui qt` magic command.\n"
            "  - Launch IPython with the option `--gui=qt`.\n"
            "  - (recommended) in your IPython configuration file, add"
            " or uncomment the line `c.TerminalIPythonApp.gui = 'qt'`."
            " Then, restart IPython."
        )
        raise RuntimeError(message)
    super().__init__(
        title=title,
        ndisplay=ndisplay,
        order=order,
        axis_labels=axis_labels,
    )
    qt_viewer = QtViewer(self)
    self.window = Window(qt_viewer)
    self.screenshot = self.window.qt_viewer.screenshot
    self.update_console = self.window.qt_viewer.console.push