DIRECT search city with Python without server deployment: RuntimeError: Cannot run the event loop while another loop is running #3247
Unanswered
myrainbowandsky
asked this question in
Q&A
Replies: 2 comments
-
This code example works fine for me. Do you run this snippet separately or as part of a larger script? Also, Ubuntu 22.04 ships with Python 3.10 by default. Do you use some special setup? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Though it's an old question async def _search_address(addr_text):
async with napi.NominatimAPIAsync(Path('.')) as api:
try:
return await api.search(addr_text)
except TimeoutError:
print(f'TimeoutError while searching {addr_text}') search_coro = _search_address('Brugge')
future = asyncio.run_coroutine_threadsafe(search_coro, _eventloop_running_on_separate_thread)
return future.result() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Ubuntu 22.04
python 3.9.13
current folder:
project/website
nominatim
is in../../
I got:
Beta Was this translation helpful? Give feedback.
All reactions