diff --git a/trezorlib/tx_api.py b/trezorlib/tx_api.py index 6a787b823..b1dd2b5de 100644 --- a/trezorlib/tx_api.py +++ b/trezorlib/tx_api.py @@ -45,9 +45,9 @@ class TxApi(object): j = r.json() except: raise Exception('URL error: %s' % url) - if cache_file: + if cache_dir and cache_file: try: # saving into cache - json.dump(j, open(cachefile, 'w')) + json.dump(j, open(cache_file, 'w')) except: pass return j