# Buggy code
def __init__(self, server, options):
    flow.FlowMaster.__init__(self, options, server, flow.State())
    self.has_errored = False
    self.addons.add(options, *builtins.default_addons())
    self.addons.add(options, dumper.Dumper())
    # This line is just for type hinting
    self.options = self.options  # type: Options
    self.server_replay_ignore_params = options.server_replay_ignore_params
    self.server_replay_ignore_content = options.server_replay_ignore_content
    self.server_replay_ignore_host = options.server_replay_ignore_host
    self.refresh_server_playback = options.refresh_server_playback
    self.server_replay_ignore_payload_params = (
        options.server_replay_ignore_payload_params
    )

    self.set_stream_large_bodies(options.stream_large_bodies)

    if self.server and self.options.http2 and not tcp.HAS_ALPN:  # pragma: no cover
        print(
            "ALPN support missing (OpenSSL 1.0.2+ required)!\n"
            "HTTP/2 is disabled. Use --no-http2 to silence this warning.",
            file=sys.stderr,
        )

    if options.client_replay:
        self.start_client_playback(
            self._readflow(options.client_replay), not options.keepserving
        )

    if options.rfile:
        try:
            self.load_flows_file(options.rfile)
        except exceptions.FlowReadException as v:
            self.add_log("Flow file corrupted.", "error")
            raise DumpError(v)

    if self.options.app:
        self.start_app(self.options.app_host, self.options.app_port)


# Traceback (AttributeError)
user@user-ubuntu:~$ mitmproxy
Traceback (most recent call last):
File "/media/sf_git/mitmproxy/mitmproxy/console/master.py", line 317, in run_script_once
s = script.Script(command)
AttributeError: module 'mitmproxy.script' has no attribute 'Script'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/media/sf_git/mitmproxy/mitmproxy/console/master.py", line 498, in run
self.loop.run()
File "/usr/local/lib/python3.5/dist-packages/urwid/main_loop.py", line 278, in run
self._run()
File "/usr/local/lib/python3.5/dist-packages/urwid/main_loop.py", line 376, in _run
self.event_loop.run()
File "/usr/local/lib/python3.5/dist-packages/urwid/main_loop.py", line 682, in run
self._loop()
File "/usr/local/lib/python3.5/dist-packages/urwid/main_loop.py", line 719, in _loop
self._watch_files[fd]()
File "/usr/local/lib/python3.5/dist-packages/urwid/raw_display.py", line 393, in <lambda>
event_loop, callback, self.get_available_raw_input())
File "/usr/local/lib/python3.5/dist-packages/urwid/raw_display.py", line 493, in parse_input
callback(processed, processed_codes)
File "/usr/local/lib/python3.5/dist-packages/urwid/main_loop.py", line 403, in _update
self.process_input(keys)
File "/usr/local/lib/python3.5/dist-packages/urwid/main_loop.py", line 503, in process_input
k = self._topmost_widget.keypress(self.screen_size, k)
File "/media/sf_git/mitmproxy/mitmproxy/console/window.py", line 42, in keypress
k = super(self.__class__, self).keypress(size, k)
File "/usr/local/lib/python3.5/dist-packages/urwid/container.py", line 1116, in keypress
return self.footer.keypress((maxcol,),key)
File "/media/sf_git/mitmproxy/mitmproxy/console/statusbar.py", line 134, in keypress
return self.master.ab.keypress(*args, **kwargs)
File "/media/sf_git/mitmproxy/mitmproxy/console/statusbar.py", line 89, in keypress
self.prompt_execute(self._w.get_edit_text())
File "/media/sf_git/mitmproxy/mitmproxy/console/statusbar.py", line 112, in prompt_execute
msg = p(txt, *args)
File "/media/sf_git/mitmproxy/mitmproxy/console/master.py", line 319, in run_script_once
except script.ScriptException as e:
AttributeError: module 'mitmproxy.script' has no attribute 'ScriptException'

# Fixed code
def __init__(self, server, options):
    flow.FlowMaster.__init__(self, options, server, flow.State())
    self.has_errored = False
    self.addons.add(options, *builtins.default_addons())
    self.addons.add(options, dumper.Dumper())
    # This line is just for type hinting
    self.options = self.options  # type: Options
    self.set_stream_large_bodies(options.stream_large_bodies)

    if self.server and self.options.http2 and not tcp.HAS_ALPN:  # pragma: no cover
        print(
            "ALPN support missing (OpenSSL 1.0.2+ required)!\n"
            "HTTP/2 is disabled. Use --no-http2 to silence this warning.",
            file=sys.stderr,
        )

    if options.client_replay:
        self.start_client_playback(
            self._readflow(options.client_replay), not options.keepserving
        )

    if options.rfile:
        try:
            self.load_flows_file(options.rfile)
        except exceptions.FlowReadException as v:
            self.add_log("Flow file corrupted.", "error")
            raise DumpError(v)

    if self.options.app:
        self.start_app(self.options.app_host, self.options.app_port)