# Buggy code
def create_wallet(self, password=""):
    """
    Create a new bitcoin wallet.
    """
    self._logger.info("Creating wallet in %s", self.wallet_dir)

    def run_on_thread(thread_method):
        # We are running code that writes to the wallet on a separate thread.
        # This is done because ethereum does not allow writing to a wallet from a daemon thread.
        wallet_thread = Thread(target=thread_method, name="ethereum-create-wallet")
        wallet_thread.setDaemon(False)
        wallet_thread.start()
        wallet_thread.join()

    seed = Mnemonic("en").make_seed()
    k = keystore.from_seed(seed, "")
    k.update_password(None, password)
    self.storage.put("keystore", k.dump())
    self.storage.put("wallet_type", "standard")
    self.storage.set_password(password, bool(password))
    run_on_thread(self.storage.write)

    self.wallet = ElectrumWallet(self.storage)
    self.wallet.synchronize()
    run_on_thread(self.wallet.storage.write)
    self.created = True

    if password is not None:
        self.set_wallet_password(password)
    self.wallet_password = password

    self.start_daemon()
    self.open_wallet()

    self._logger.info("Bitcoin wallet saved in '%s'", self.wallet.storage.path)

    return succeed(None)


# Traceback (EOFError)
Gkr-Message: secret service operation failed: The name org.freedesktop.secrets was not provided by any .service files
Exception in thread tribler-pipe-read:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/bram/git/tribler/TriblerGUI/core_manager.py", line 173, in <lambda>
pipe_thread = Thread(target=lambda: self.pipe_wait(parent_conn), name="tribler-pipe-read")
File "/home/bram/git/tribler/TriblerGUI/core_manager.py", line 158, in pipe_wait
cmd, arg = child_conn.recv()
EOFError

# Fixed code
def create_wallet(self, password=""):
    """
    Create a new bitcoin wallet.
    """
    self._logger.info("Creating wallet in %s", self.wallet_dir)

    if password is not None:
        try:
            self.set_wallet_password(password)
        except InitError:
            return fail(
                RuntimeError(
                    "Cannot initialize the keychain, unable to unlock the wallet!"
                )
            )
    self.wallet_password = password

    def run_on_thread(thread_method):
        # We are running code that writes to the wallet on a separate thread.
        # This is done because Electrum does not allow writing to a wallet from a daemon thread.
        wallet_thread = Thread(target=thread_method, name="ethereum-create-wallet")
        wallet_thread.setDaemon(False)
        wallet_thread.start()
        wallet_thread.join()

    seed = Mnemonic("en").make_seed()
    k = keystore.from_seed(seed, "")
    k.update_password(None, password)
    self.storage.put("keystore", k.dump())
    self.storage.put("wallet_type", "standard")
    self.storage.set_password(password, bool(password))
    run_on_thread(self.storage.write)

    self.wallet = ElectrumWallet(self.storage)
    self.wallet.synchronize()
    run_on_thread(self.wallet.storage.write)
    self.created = True
    self.unlocked = True

    self.start_daemon()
    self.open_wallet()

    self._logger.info("Bitcoin wallet saved in '%s'", self.wallet.storage.path)

    return succeed(None)