Skip to content

How to use with asyncio? #30

@hemulin

Description

@hemulin

Hi and thanks for this lovely project.

I have a small webserver using aiohttp (which in turn, wraps asyncio).

When running it like so: python -m cprofilev main.py I get the following error:

[cProfileV]: cProfile output available at http://127.0.0.1:4000
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.8/cProfile.py", line 100, in runctx
    exec(cmd, globals, locals)
  File "main.py", line 255, in <module>
    main()
  File "main.py", line 239, in main
    web.run_app(app, port=WEBSERVER_PORT)
  File "/home/hemulin/workspace/venv/lib/python3.8/site-packages/aiohttp/web.py", line 409, in run_app
    loop = asyncio.get_event_loop()
  File "/usr/lib/python3.8/asyncio/events.py", line 639, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
RuntimeError: There is no current event loop in thread 'Thread-1'.

Any idea how to use this profiler with asyncio?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions