# Buggy code
def load(self, name, temp=False):
    """Load a named session.

    Args:
        name: The name of the session to load.
        temp: If given, don't set the current session.
    """
    path = self._get_session_path(name, check_exists=True)
    try:
        with open(path, encoding="utf-8") as f:
            data = utils.yaml_load(f)
    except (OSError, UnicodeDecodeError, yaml.YAMLError) as e:
        raise SessionError(e)

    log.sessions.debug("Loading session {} from {}...".format(name, path))
    for win in data["windows"]:
        window = mainwindow.MainWindow(
            geometry=win["geometry"], private=win.get("private", None)
        )
        window.show()
        tabbed_browser = objreg.get(
            "tabbed-browser", scope="window", window=window.win_id
        )
        tab_to_focus = None
        for i, tab in enumerate(win["tabs"]):
            new_tab = tabbed_browser.tabopen(background=False)
            self._load_tab(new_tab, tab)
            if tab.get("active", False):
                tab_to_focus = i
            if new_tab.data.pinned:
                tabbed_browser.set_tab_pinned(new_tab, new_tab.data.pinned)
        if tab_to_focus is not None:
            tabbed_browser.setCurrentIndex(tab_to_focus)
        if win.get("active", False):
            QTimer.singleShot(0, tabbed_browser.activateWindow)

    if data["windows"]:
        self.did_load = True
    if not name.startswith("_") and not temp:
        self._current = name


# Traceback (ValueError)
16:39:44 DEBUG    init       app:_init_modules:468 Initializing websettings...
16:39:45 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/bin/qutebrowser", line 11, in <module>
load_entry_point('qutebrowser==1.1.1', 'gui_scripts', 'qutebrowser')()
File "/usr/lib/python3.6/site-packages/qutebrowser/qutebrowser.py", line 188, in main
return app.run(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 137, in run
init(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 163, in init
_init_modules(args, crash_handler)
File "/usr/lib/python3.6/site-packages/qutebrowser/app.py", line 469, in _init_modules
websettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 215, in init
webenginesettings.init(args)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 297, in init
websettings.init_mappings(MAPPINGS)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 198, in init_mappings
mapping.set(value)
File "/usr/lib/python3.6/site-packages/qutebrowser/config/websettings.py", line 72, in set
self._set(value, settings=settings)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in _set
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 154, in <listcomp>
filenames = [self._find_installed(code) for code in value]
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/webenginesettings.py", line 143, in _find_installed
local_filename = spell.local_filename(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 64, in local_filename
all_installed = local_files(code)
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 51, in local_files
for matching_dict in sorted(matching_dicts, key=version, reverse=True):
File "/usr/lib/python3.6/site-packages/qutebrowser/browser/webengine/spell.py", line 36, in version
.format(filename))
ValueError: the given dictionary file name is malformed: /usr/share/qt/qtwebengine_dictionaries/en-US.bdic

# Fixed code
def load(self, name, temp=False):
    """Load a named session.

    Args:
        name: The name of the session to load.
        temp: If given, don't set the current session.
    """
    path = self._get_session_path(name, check_exists=True)
    try:
        with open(path, encoding="utf-8") as f:
            data = utils.yaml_load(f)
    except (OSError, UnicodeDecodeError, yaml.YAMLError) as e:
        raise SessionError(e)

    log.sessions.debug("Loading session {} from {}...".format(name, path))
    for win in data["windows"]:
        window = mainwindow.MainWindow(
            geometry=win["geometry"], private=win.get("private", None)
        )
        window.show()
        tabbed_browser = objreg.get(
            "tabbed-browser", scope="window", window=window.win_id
        )
        tab_to_focus = None
        for i, tab in enumerate(win["tabs"]):
            new_tab = tabbed_browser.tabopen(background=False)
            self._load_tab(new_tab, tab)
            if tab.get("active", False):
                tab_to_focus = i
            if new_tab.data.pinned:
                tabbed_browser.widget.set_tab_pinned(new_tab, new_tab.data.pinned)
        if tab_to_focus is not None:
            tabbed_browser.widget.setCurrentIndex(tab_to_focus)
        if win.get("active", False):
            QTimer.singleShot(0, tabbed_browser.widget.activateWindow)

    if data["windows"]:
        self.did_load = True
    if not name.startswith("_") and not temp:
        self._current = name