2020-02-11 20:53:03 +01:00
|
|
|
import sys
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
# these are ~duplicated from run_electrum:
|
|
|
|
|
is_bundle = getattr(sys, 'frozen', False)
|
|
|
|
|
is_local = not is_bundle and os.path.exists(os.path.join(os.path.dirname(os.path.dirname(__file__)), "electrum.desktop"))
|
|
|
|
|
|
|
|
|
|
# when running from source, on Windows, also search for DLLs in inner 'electrum' folder
|
2025-06-15 18:25:42 +00:00
|
|
|
if is_local and os.name == 'nt': # fixme: duplicated between main script and __init__.py :(
|
2024-06-05 14:55:48 +00:00
|
|
|
os.add_dll_directory(os.path.dirname(__file__))
|
2020-02-11 20:53:03 +01:00
|
|
|
|
|
|
|
|
|
2022-04-11 16:53:25 +02:00
|
|
|
class GuiImportError(ImportError):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
2017-01-22 21:25:24 +03:00
|
|
|
from .version import ELECTRUM_VERSION
|
2019-04-26 20:45:23 +02:00
|
|
|
from .util import format_satoshis
|
2018-07-18 11:18:57 +02:00
|
|
|
from .wallet import Wallet
|
2017-01-22 21:25:24 +03:00
|
|
|
from .storage import WalletStorage
|
|
|
|
|
from .coinchooser import COIN_CHOOSERS
|
|
|
|
|
from .network import Network, pick_random_server
|
2018-08-16 18:16:25 +02:00
|
|
|
from .interface import Interface
|
2019-09-10 18:01:10 +02:00
|
|
|
from .simple_config import SimpleConfig
|
2017-01-22 21:25:24 +03:00
|
|
|
from . import bitcoin
|
|
|
|
|
from . import transaction
|
|
|
|
|
from . import daemon
|
|
|
|
|
from .transaction import Transaction
|
2018-07-11 17:38:47 +02:00
|
|
|
from .plugin import BasePlugin
|
2017-01-22 21:25:24 +03:00
|
|
|
from .commands import Commands, known_commands
|
2023-03-31 13:03:26 +00:00
|
|
|
from .logging import get_logger
|
2018-10-31 16:21:04 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
__version__ = ELECTRUM_VERSION
|
2023-03-31 13:03:26 +00:00
|
|
|
|
|
|
|
|
_logger = get_logger(__name__)
|
2023-06-01 17:34:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# Ensure that asserts are enabled. For sanity and paranoia, we require this.
|
|
|
|
|
# Code *should not rely* on asserts being enabled. In particular, safety and security checks should
|
|
|
|
|
# always explicitly raise exceptions. However, this rule is mistakenly broken occasionally...
|
|
|
|
|
try:
|
2023-06-01 22:59:40 +00:00
|
|
|
assert False # noqa: B011
|
2023-06-01 17:34:32 +00:00
|
|
|
except AssertionError:
|
|
|
|
|
pass
|
|
|
|
|
else:
|
|
|
|
|
raise ImportError("Running with asserts disabled. Refusing to continue. Exiting...")
|
|
|
|
|
|