# Buggy code
def __init__(self, session):
    resource.Resource.__init__(self)
    self.session = session
    self.events_requests = []

    self.infohashes_sent = set()
    self.channel_cids_sent = set()

    self.session.add_observer(
        self.on_search_results_channels, SIGNAL_CHANNEL, [SIGNAL_ON_SEARCH_RESULTS]
    )
    self.session.add_observer(
        self.on_search_results_torrents, SIGNAL_TORRENT, [SIGNAL_ON_SEARCH_RESULTS]
    )
    self.session.add_observer(self.on_upgrader_started, NTFY_UPGRADER, [NTFY_STARTED])
    self.session.add_observer(self.on_upgrader_finished, NTFY_UPGRADER, [NTFY_FINISHED])
    self.session.add_observer(self.on_upgrader_tick, NTFY_UPGRADER_TICK, [NTFY_STARTED])
    self.session.add_observer(
        self.on_watch_folder_corrupt_torrent,
        NTFY_WATCH_FOLDER_CORRUPT_TORRENT,
        [NTFY_INSERT],
    )
    self.session.add_observer(
        self.on_new_version_available, NTFY_NEW_VERSION, [NTFY_INSERT]
    )
    self.session.add_observer(self.on_tribler_started, NTFY_TRIBLER, [NTFY_STARTED])
    self.session.add_observer(
        self.on_channel_discovered, NTFY_CHANNEL, [NTFY_DISCOVERED]
    )
    self.session.add_observer(
        self.on_torrent_discovered, NTFY_TORRENT, [NTFY_DISCOVERED]
    )
    self.session.add_observer(
        self.on_torrent_removed_from_channel, NTFY_TORRENT, [NTFY_DELETE]
    )
    self.session.add_observer(self.on_torrent_finished, NTFY_TORRENT, [NTFY_FINISHED])
    self.session.add_observer(self.on_torrent_error, NTFY_TORRENT, [NTFY_ERROR])
    self.session.add_observer(self.on_market_ask, NTFY_MARKET_ON_ASK, [NTFY_UPDATE])
    self.session.add_observer(self.on_market_bid, NTFY_MARKET_ON_BID, [NTFY_UPDATE])
    self.session.add_observer(
        self.on_market_ask_timeout, NTFY_MARKET_ON_ASK_TIMEOUT, [NTFY_UPDATE]
    )
    self.session.add_observer(
        self.on_market_bid_timeout, NTFY_MARKET_ON_BID_TIMEOUT, [NTFY_UPDATE]
    )
    self.session.add_observer(
        self.on_market_transaction_complete,
        NTFY_MARKET_ON_TRANSACTION_COMPLETE,
        [NTFY_UPDATE],
    )
    self.session.add_observer(
        self.on_market_payment_received, NTFY_MARKET_ON_PAYMENT_RECEIVED, [NTFY_UPDATE]
    )
    self.session.add_observer(
        self.on_market_payment_sent, NTFY_MARKET_ON_PAYMENT_SENT, [NTFY_UPDATE]
    )
    self.session.add_observer(
        self.on_resource_event, SIGNAL_RESOURCE_CHECK, [SIGNAL_LOW_SPACE]
    )


# Traceback (RuntimeError)
Traceback (most recent call last):
File "TriblerGUI\event_request_manager.py", line 127, in on_read_data
RuntimeError: [Failure instance: Traceback: <type 'exceptions.WindowsError'>: [Error 3] The system cannot find the path specified
lib\site-packages\twisted\internet\base.py:1243:run
lib\site-packages\twisted\internet\base.py:1252:mainLoop
lib\site-packages\twisted\internet\base.py:878:runUntilCurrent
lib\site-packages\twisted\internet\task.py:239:__call__
--- <exception caught here> ---
lib\site-packages\twisted\internet\defer.py:150:maybeDeferred
Tribler\Core\CreditMining\CreditMiningManager.py:98:check_disk_space
Tribler\Core\CreditMining\CreditMiningManager.py:93:get_free_disk_space
lib\site-packages\psutil\__init__.py:2040:disk_usage
lib\site-packages\psutil\_pswindows.py:249:disk_usage
]

# Fixed code
def __init__(self, session):
    resource.Resource.__init__(self)
    self.session = session
    self.events_requests = []

    self.infohashes_sent = set()
    self.channel_cids_sent = set()

    self.session.add_observer(
        self.on_search_results_channels, SIGNAL_CHANNEL, [SIGNAL_ON_SEARCH_RESULTS]
    )
    self.session.add_observer(
        self.on_search_results_torrents, SIGNAL_TORRENT, [SIGNAL_ON_SEARCH_RESULTS]
    )
    self.session.add_observer(self.on_upgrader_started, NTFY_UPGRADER, [NTFY_STARTED])
    self.session.add_observer(self.on_upgrader_finished, NTFY_UPGRADER, [NTFY_FINISHED])
    self.session.add_observer(self.on_upgrader_tick, NTFY_UPGRADER_TICK, [NTFY_STARTED])
    self.session.add_observer(
        self.on_watch_folder_corrupt_torrent,
        NTFY_WATCH_FOLDER_CORRUPT_TORRENT,
        [NTFY_INSERT],
    )
    self.session.add_observer(
        self.on_new_version_available, NTFY_NEW_VERSION, [NTFY_INSERT]
    )
    self.session.add_observer(self.on_tribler_started, NTFY_TRIBLER, [NTFY_STARTED])
    self.session.add_observer(
        self.on_channel_discovered, NTFY_CHANNEL, [NTFY_DISCOVERED]
    )
    self.session.add_observer(
        self.on_torrent_discovered, NTFY_TORRENT, [NTFY_DISCOVERED]
    )
    self.session.add_observer(
        self.on_torrent_removed_from_channel, NTFY_TORRENT, [NTFY_DELETE]
    )
    self.session.add_observer(self.on_torrent_finished, NTFY_TORRENT, [NTFY_FINISHED])
    self.session.add_observer(self.on_torrent_error, NTFY_TORRENT, [NTFY_ERROR])
    self.session.add_observer(self.on_market_ask, NTFY_MARKET_ON_ASK, [NTFY_UPDATE])
    self.session.add_observer(self.on_market_bid, NTFY_MARKET_ON_BID, [NTFY_UPDATE])
    self.session.add_observer(
        self.on_market_ask_timeout, NTFY_MARKET_ON_ASK_TIMEOUT, [NTFY_UPDATE]
    )
    self.session.add_observer(
        self.on_market_bid_timeout, NTFY_MARKET_ON_BID_TIMEOUT, [NTFY_UPDATE]
    )
    self.session.add_observer(
        self.on_market_transaction_complete,
        NTFY_MARKET_ON_TRANSACTION_COMPLETE,
        [NTFY_UPDATE],
    )
    self.session.add_observer(
        self.on_market_payment_received, NTFY_MARKET_ON_PAYMENT_RECEIVED, [NTFY_UPDATE]
    )
    self.session.add_observer(
        self.on_market_payment_sent, NTFY_MARKET_ON_PAYMENT_SENT, [NTFY_UPDATE]
    )
    self.session.add_observer(
        self.on_resource_event, SIGNAL_RESOURCE_CHECK, [SIGNAL_LOW_SPACE]
    )
    self.session.add_observer(
        self.on_credit_minig_error, NTFY_CREDIT_MINING, [NTFY_ERROR]
    )