# Buggy code
def on_wallets(self, wallets):
    if not wallets:
        return
    self.wallets = wallets["wallets"]

    if "MB" in self.wallets and self.wallets["MB"]["created"]:
        self.window().wallet_mc_overview_button.show()

    if "BTC" in self.wallets and self.wallets["BTC"]["created"]:
        self.window().wallet_btc_overview_button.show()
    elif "BTC" not in self.wallets:
        self.wallets["BTC"] = {"name": "Bitcoin", "created": False, "identifier": "BTC"}

    if "TBTC" in self.wallets and self.wallets["TBTC"]["created"]:
        self.window().wallet_tbtc_overview_button.show()
    elif "TBTC" not in self.wallets:
        self.wallets["TBTC"] = {
            "name": "Testnet BTC",
            "created": False,
            "identifier": "TBTC",
        }

    # Find out which wallets we still can create
    self.wallets_to_create = []
    for identifier, wallet in self.wallets.iteritems():
        if not wallet["created"]:
            self.wallets_to_create.append(identifier)

    if len(self.wallets_to_create) > 0:
        self.window().add_wallet_button.setEnabled(True)
    else:
        self.window().add_wallet_button.hide()


# Traceback (RuntimeError)
Traceback (most recent call last):
File "TriblerGUI\core_manager.py", line 114, in on_received_state
RuntimeError: Unhandled Error
Traceback (most recent call last):
File "lib\site-packages\twisted\internet\base.py", line 428, in fireEvent

File "lib\site-packages\twisted\internet\defer.py", line 321, in addCallback

File "lib\site-packages\twisted\internet\defer.py", line 310, in addCallbacks

File "lib\site-packages\twisted\internet\defer.py", line 653, in _runCallbacks

--- <exception caught here> ---
File "lib\site-packages\twisted\internet\base.py", line 441, in _continueFiring

File "run_tribler.py", line 73, in start_tribler

File "Tribler\pyipv8\ipv8\util.py", line 14, in helper

File "Tribler\pyipv8\ipv8\util.py", line 26, in blockingCallFromThread

File "Tribler\Core\Session.py", line 487, in start

File "Tribler\Core\APIImplementation\LaunchManyCore.py", line 226, in register

File "Tribler\Core\APIImplementation\LaunchManyCore.py", line 406, in init

File "c:\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module

File "Tribler\Core\Modules\wallet\btc_wallet.py", line 4, in <module>

File "c:\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module

File "lib\site-packages\bitcoinlib\__init__.py", line 20, in <module>

File "c:\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module

File "lib\site-packages\bitcoinlib\encoding.py", line 30, in <module>

File "c:\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module

File "lib\site-packages\bitcoinlib\main.py", line 75, in <module>

File "lib\site-packages\bitcoinlib\main.py", line 69, in initialize_lib

exceptions.WindowsError: [Error 3] Het systeem kan het opgegeven pad niet vinden: 'D:\\Program Files\\Tribler\\bitcoinlib\\data/*.*'

# Fixed code
def on_wallets(self, wallets):
    if not wallets:
        return
    self.wallets = wallets["wallets"]
    self.btc_module_available = "BTC" in self.wallets

    if "MB" in self.wallets and self.wallets["MB"]["created"]:
        self.window().wallet_mc_overview_button.show()

    if "BTC" in self.wallets and self.wallets["BTC"]["created"]:
        self.window().wallet_btc_overview_button.show()
    elif "BTC" not in self.wallets:
        self.wallets["BTC"] = {"name": "Bitcoin", "created": False, "identifier": "BTC"}

    if "TBTC" in self.wallets and self.wallets["TBTC"]["created"]:
        self.window().wallet_tbtc_overview_button.show()
    elif "TBTC" not in self.wallets:
        self.wallets["TBTC"] = {
            "name": "Testnet BTC",
            "created": False,
            "identifier": "TBTC",
        }

    # Find out which wallets we still can create
    self.wallets_to_create = []
    for identifier, wallet in self.wallets.iteritems():
        if not wallet["created"]:
            self.wallets_to_create.append(identifier)

    if len(self.wallets_to_create) > 0:
        self.window().add_wallet_button.setEnabled(True)
    else:
        self.window().add_wallet_button.hide()