diff --git a/python/src/trezorlib/client.py b/python/src/trezorlib/client.py index 2eaaf2f40b..24b4ccbb48 100644 --- a/python/src/trezorlib/client.py +++ b/python/src/trezorlib/client.py @@ -15,6 +15,7 @@ # If not, see . import logging +import os import sys import warnings from types import SimpleNamespace @@ -73,13 +74,16 @@ def get_default_client(path=None, ui=None, **kwargs): Returns a TrezorClient instance with minimum fuss. - If no path is specified, finds first connected Trezor. Otherwise performs - a prefix-search for the specified device. If no UI is supplied, instantiates - the default CLI UI. + If path is specified, does a prefix-search for the specified device. Otherwise, uses + the value of TREZOR_PATH env variable, or finds first connected Trezor. + If no UI is supplied, instantiates the default CLI UI. """ from .transport import get_transport from .ui import ClickUI + if path is None: + path = os.getenv("TREZOR_PATH") + transport = get_transport(path, prefix_search=True) if ui is None: ui = ClickUI()