From 5d2d621055abad6b609263e9deaaf1f9f02bcd40 Mon Sep 17 00:00:00 2001 From: Nicola Larosa Date: Mon, 13 Nov 2017 22:15:09 +0100 Subject: [PATCH] Fix error when using trezorctl to connect to the trezor-core emulator. (#152) * Fix error when using trezorctl to connect to the trezor-core emulator. * Restore the ability to specify the host without the port --- trezorlib/transport_udp.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trezorlib/transport_udp.py b/trezorlib/transport_udp.py index b7a2160..5e81a5f 100644 --- a/trezorlib/transport_udp.py +++ b/trezorlib/transport_udp.py @@ -36,9 +36,9 @@ class UdpTransport(Transport): host = UdpTransport.DEFAULT_HOST port = UdpTransport.DEFAULT_PORT else: - host = device.split(':').get(0) - port = device.split(':').get(1, UdpTransport.DEFAULT_PORT) - port = int(port) + devparts = device.split(':') + host = devparts[0] + port = int(devparts[1]) if len(devparts) > 1 else UdpTransport.DEFAULT_PORT if not protocol: protocol = ProtocolV2() self.device = (host, port)