exchange_rate: fix regenerating currencies.json
```
cannot find currencies.json. will regenerate it now.
Traceback (most recent call last):
File "...\electrum\run_electrum", line 94, in <module>
from electrum.logging import get_logger, configure_logging # import logging submodule first
File "...\electrum\electrum\__init__.py", line 27, in <module>
from . import daemon
File "...\electrum\electrum\daemon.py", line 55, in <module>
from .exchange_rate import FxThread
File "...\electrum\electrum\exchange_rate.py", line 539, in <module>
CURRENCIES = get_exchanges_and_currencies()
File "...\electrum\electrum\exchange_rate.py", line 529, in get_exchanges_and_currencies
loop = util.get_asyncio_loop()
File "...\electrum\electrum\util.py", line 1578, in get_asyncio_loop
raise Exception("event loop not created yet")
Exception: event loop not created yet
```
This commit is contained in:
@@ -526,11 +526,14 @@ def get_exchanges_and_currencies():
|
|||||||
for name, klass in exchanges.items():
|
for name, klass in exchanges.items():
|
||||||
exchange = klass(None, None)
|
exchange = klass(None, None)
|
||||||
await group.spawn(get_currencies_safe(name, exchange))
|
await group.spawn(get_currencies_safe(name, exchange))
|
||||||
loop = util.get_asyncio_loop()
|
|
||||||
|
loop = asyncio.new_event_loop()
|
||||||
try:
|
try:
|
||||||
loop.run_until_complete(query_all_exchanges_for_their_ccys_over_network())
|
loop.run_until_complete(query_all_exchanges_for_their_ccys_over_network())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
finally:
|
||||||
|
loop.close()
|
||||||
with open(path, 'w', encoding='utf-8') as f:
|
with open(path, 'w', encoding='utf-8') as f:
|
||||||
f.write(json.dumps(d, indent=4, sort_keys=True))
|
f.write(json.dumps(d, indent=4, sort_keys=True))
|
||||||
return d
|
return d
|
||||||
|
|||||||
Reference in New Issue
Block a user