Error when importing chessdotcom library in my streamlit app

When I import chessdotcom library, my streamlit app throws an error:

2022-05-31 14:40:43.430 Traceback (most recent call last):
  File "C:\Users\Lenovo\Desktop\chess\env\lib\site-packages\streamlit\scriptrunner\script_runner.py", line 475, in _run_script
    exec(code, module.__dict__)
  File "C:\Users\Lenovo\Desktop\chess\main.py", line 1, in <module>
    from chessdotcom import get_player_profile
  File "C:\Users\Lenovo\Desktop\chess\env\lib\site-packages\chessdotcom\__init__.py", line 2, in <module>
    from chessdotcom.client import *
  File "C:\Users\Lenovo\Desktop\chess\env\lib\site-packages\chessdotcom\client.py", line 17, in <module>
    class Client:
  File "C:\Users\Lenovo\Desktop\chess\env\lib\site-packages\chessdotcom\client.py", line 26, in Client
    loop = get_event_loop()
  File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 656, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
RuntimeError: There is no current event loop in thread 'ScriptRunner.scriptThread'.

What shall I do?

Hi @Karan, welcome to the Streamlit community!

Can you post a code snippet or GitHub repo that demonstrates this behavior, so that others can see what you’ve tried and make suggestions?

Best,
Randy

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.