sockysec / Telerecon

A reconnaissance framework for researching and investigating Telegram.
828 stars 115 forks source link

start an asynchronous event loop while one is already running #11

Closed NeonBubbles closed 8 months ago

NeonBubbles commented 9 months ago

I Picked the number 3 and collected user messages from a target channel; After the task was finished, I returned to the launcher menu. If I picked the number 3 again, the error would occur.

Pick a number: 3 Loading userscraper.py... Traceback (most recent call last): File "D:\Telerecon\launcher.py", line 127, in exec(open(choice).read()) File "", line 157, in File "D:\anaconda3\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "D:\anaconda3\lib\asyncio\base_events.py", line 649, in run_until_complete return future.result() File "", line 153, in main File "", line 127, in File "", line 157, in File "D:\anaconda3\lib\asyncio\runners.py", line 33, in run raise RuntimeError( RuntimeError: asyncio.run() cannot be called from a running event loop sys:1: RuntimeWarning: coroutine 'main' was never awaited

The GPT4 told me: "The error message RuntimeError: asyncio.run() cannot be called from a running event loop indicates that you are trying to start an asynchronous event loop while one is already running. This can happen when using asyncio.run() in an environment where an event loop is already in place, or when calling asyncio.run() multiple times within the same context."

NeonBubbles commented 9 months ago

I realize this is a known issue, But I hope it can be fixed one day.

NeonBubbles commented 9 months ago

13

sockysec commented 8 months ago

Thanks @NeonBubbles for the fix

NeonBubbles commented 8 months ago

Thanks @NeonBubbles for the fix

I eventually revoked the changes to launcher.py in that pull request, so this issue hasn't been fixed. because subprocess.open() and exec() may lead to the recursive call. However, it indeed could serve as a temporary solution. I plan to address this issue in a new pull request.