diff --git a/joinmarket/configure.py b/joinmarket/configure.py index 5c4e3a47..f9236776 100644 --- a/joinmarket/configure.py +++ b/joinmarket/configure.py @@ -39,7 +39,8 @@ def __setattr__(self, name, value): logFormatter = logging.Formatter( ('%(asctime)s [%(threadName)-12.12s] ' '[%(levelname)-5.5s] %(message)s')) - fileHandler = logging.FileHandler('logs/{}.log'.format(value)) + dirname = os.path.split(os.path.abspath(__file__)) + fileHandler = logging.FileHandler(os.path.join(dirname[0][:-11], 'logs/{}.log'.format(value))) fileHandler.setFormatter(logFormatter) log.addHandler(fileHandler) diff --git a/joinmarket/wallet.py b/joinmarket/wallet.py index 555629f7..d659517a 100644 --- a/joinmarket/wallet.py +++ b/joinmarket/wallet.py @@ -147,9 +147,10 @@ def __init__(self, self.index.append([0, 0]) def read_wallet_file_data(self, filename, pwd=None): + dirname = os.path.split(os.path.abspath(__file__)) self.path = None self.index_cache = [[0, 0]] * self.max_mix_depth - path = os.path.join('wallets', filename) + path = os.path.join(dirname[0][:-11], 'wallets', filename) if not os.path.isfile(path): if get_network() == 'testnet': log.debug('filename interpreted as seed, only available in ' diff --git a/wallet-tool.py b/wallet-tool.py index 130b6fc1..f5f91cfa 100644 --- a/wallet-tool.py +++ b/wallet-tool.py @@ -270,14 +270,16 @@ def cus_print(s): elif method == 'listwallets': # Fetch list of wallets possible_wallets = [] - for (dirpath, dirnames, filenames) in os.walk('wallets'): + dirname = os.path.split(os.path.abspath(__file__)) + for (dirpath, dirnames, filenames) in os.walk(os.path.join(dirname[0], 'wallets')): possible_wallets.extend(filenames) # Breaking as we only want the top dir, not subdirs break # For each possible wallet file, read json to list walletjsons = [] for possible_wallet in possible_wallets: - fd = open(os.path.join('wallets', possible_wallet), 'r') + dirname = os.path.split(os.path.abspath(__file__)) + fd = open(os.path.join(dirname[0], 'wallets', possible_wallet), 'r') try: walletfile = fd.read() walletjson = json.loads(walletfile)