Skip to content

Fix the event loop error with importlib method#14

Open
NeonBubbles wants to merge 2 commits intosockysec:mainfrom
NeonBubbles:event_loop
Open

Fix the event loop error with importlib method#14
NeonBubbles wants to merge 2 commits intosockysec:mainfrom
NeonBubbles:event_loop

Conversation

@NeonBubbles
Copy link
Contributor

I used importlib in launcher.py to dynamically import the scripts that need to be run. For those scripts that utilize asynchronous operations, I manage the event loop directly in launcher.py, which helps avoid potential event loop errors. Therefore, to utilize importlib, I've made changes to almost all scripts' structure, but the core code remains largely unchanged. I conducted some manual tests for each script, but I recommend you do some testing again before merging. Feel free to give feedback if there are any issues.

@sockysec
Copy link
Owner

Hey Neon - A huge thanks for working through these changes to implement the importlib method! I'll conduct some tests after the holiday season, and merge/provide feedback as needed.

@sockysec
Copy link
Owner

Sorry for the long delay - just got around to beginning some testing. Looking good so far, however, I did experience the following error. Might still be some event loop/asynco issue persisting

Traceback (most recent call last):
File "/home/osint/Downloads/Telerecon/launcher.py", line 127, in
exec(open(choice).read())
File "", line 185, in
File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "", line 181, in main
File "", line 127, in
File "", line 84, in
File "/usr/lib/python3.11/asyncio/runners.py", line 186, in run
raise RuntimeError(
RuntimeError: asyncio.run() cannot be called from a running event loop
sys:1: RuntimeWarning: coroutine 'process_target_channels' was never awaited

@NeonBubbles
Copy link
Contributor Author

NeonBubbles commented Jan 25, 2024

Traceback (most recent call last):
File "/home/osint/Downloads/Telerecon/launcher.py", line 127, in
exec(open(choice).read())

You seem to be testing with the code from the current main branch instead of this pull request. I have abandoned the exec function.

@sockysec
Copy link
Owner

Haha that'll do it.

Tested the right one this time and it seems to be working well, resolving the loop issue as intended.

However... Scripts appear to load line by line like a typewriter, making them significantly slower. For example, instead of the whole launcher's text loading instantly, it prints it line by line. The same goes for results returned by queries (i.e. user details). This will need to be resolved before further testing/merging with main.

@NeonBubbles
Copy link
Contributor Author

I've never come across this issue before. When I rerun the program, it loads and displays the lines almost instantly on both of my computers. Is it possible that other applications are heavily using your system resources?
You might want to try rebooting or testing the program on a different computer to see if that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants