# Buggy code
def __init__(self):
    """Class initialiser"""
    GObject.GObject.__init__(self)

    self.terminator = Terminator()
    self.terminator.register_terminal(self)

    # FIXME: Surely these should happen in Terminator::register_terminal()?
    self.connect("enumerate", self.terminator.do_enumerate)
    self.connect("focus-in", self.terminator.focus_changed)
    self.connect("focus-out", self.terminator.focus_left)

    self.matches = {}
    self.cnxids = Signalman()

    self.config = Config()

    self.cwd = get_default_cwd()
    self.origcwd = self.terminator.origcwd
    self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)

    self.pending_on_vte_size_allocate = False

    self.vte = Vte.Terminal()
    self.vte._draw_data = None
    if not hasattr(self.vte, "set_opacity") or not hasattr(self.vte, "is_composited"):
        self.composite_support = False
    else:
        self.composite_support = True
    dbg("composite_support: %s" % self.composite_support)

    self.vte.show()

    self.default_encoding = self.vte.get_encoding()
    self.regex_flags = Vte.REGEX_FLAGS_DEFAULT | PCRE2_MULTILINE
    self.update_url_matches()

    self.terminalbox = self.create_terminalbox()

    self.titlebar = Titlebar(self)
    self.titlebar.connect_icon(self.on_group_button_press)
    self.titlebar.connect("edit-done", self.on_edit_done)
    self.connect("title-change", self.titlebar.set_terminal_title)
    self.titlebar.connect("create-group", self.really_create_group)
    self.titlebar.show_all()

    self.searchbar = Searchbar()
    self.searchbar.connect("end-search", self.on_search_done)

    self.show()
    self.pack_start(self.titlebar, False, True, 0)
    self.pack_start(self.terminalbox, True, True, 0)
    self.pack_end(self.searchbar, True, True, 0)

    self.connect_signals()

    os.putenv("TERM", self.config["term"])
    os.putenv("COLORTERM", self.config["colorterm"])

    env_proxy = os.getenv("http_proxy")
    if not env_proxy:
        if self.config["http_proxy"] and self.config["http_proxy"] != "":
            os.putenv("http_proxy", self.config["http_proxy"])
    self.reconfigure()
    self.vte.set_size(80, 24)


# Traceback (AttributeError)
$ terminator
Traceback (most recent call last):
File "/usr/bin/terminator", line 122, in <module>
TERMINATOR.create_layout(OPTIONS.layout)
File "/usr/share/terminator/terminatorlib/terminator.py", line 311, in create_layout
window, terminal = self.new_window()
File "/usr/share/terminator/terminatorlib/terminator.py", line 234, in new_window
terminal = maker.make('Terminal')
File "/usr/share/terminator/terminatorlib/factory.py", line 94, in make
output = func(**kwargs)
File "/usr/share/terminator/terminatorlib/factory.py", line 106, in make_terminal
return(terminal.Terminal())
File "/usr/share/terminator/terminatorlib/terminal.py", line 147, in __init__
self.update_url_matches()
File "/usr/share/terminator/terminatorlib/terminal.py", line 273, in update_url_matches
reg = Vte.Regex.new_for_match(re, len(re), self.regex_flags)
File "/usr/lib/python2.7/dist-packages/gi/module.py", line 139, in __getattr__
self.__name__, name))
AttributeError: 'gi.repository.Vte' object has no attribute 'Regex'

# Fixed code
def __init__(self):
    """Class initialiser"""
    GObject.GObject.__init__(self)

    self.terminator = Terminator()
    self.terminator.register_terminal(self)

    # FIXME: Surely these should happen in Terminator::register_terminal()?
    self.connect("enumerate", self.terminator.do_enumerate)
    self.connect("focus-in", self.terminator.focus_changed)
    self.connect("focus-out", self.terminator.focus_left)

    self.matches = {}
    self.cnxids = Signalman()

    self.config = Config()

    self.cwd = get_default_cwd()
    self.origcwd = self.terminator.origcwd
    self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)

    self.pending_on_vte_size_allocate = False

    self.vte = Vte.Terminal()
    self.vte._draw_data = None
    if not hasattr(self.vte, "set_opacity") or not hasattr(self.vte, "is_composited"):
        self.composite_support = False
    else:
        self.composite_support = True
    dbg("composite_support: %s" % self.composite_support)

    self.vte.show()

    self.default_encoding = self.vte.get_encoding()
    self.regex_flags = REGEX_FLAGS
    self.update_url_matches()

    self.terminalbox = self.create_terminalbox()

    self.titlebar = Titlebar(self)
    self.titlebar.connect_icon(self.on_group_button_press)
    self.titlebar.connect("edit-done", self.on_edit_done)
    self.connect("title-change", self.titlebar.set_terminal_title)
    self.titlebar.connect("create-group", self.really_create_group)
    self.titlebar.show_all()

    self.searchbar = Searchbar()
    self.searchbar.connect("end-search", self.on_search_done)

    self.show()
    self.pack_start(self.titlebar, False, True, 0)
    self.pack_start(self.terminalbox, True, True, 0)
    self.pack_end(self.searchbar, True, True, 0)

    self.connect_signals()

    os.putenv("TERM", self.config["term"])
    os.putenv("COLORTERM", self.config["colorterm"])

    env_proxy = os.getenv("http_proxy")
    if not env_proxy:
        if self.config["http_proxy"] and self.config["http_proxy"] != "":
            os.putenv("http_proxy", self.config["http_proxy"])
    self.reconfigure()
    self.vte.set_size(80, 24)