Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.0.37] DeprecationWarning: There is no current event loop (from asyncio) #1750

Closed
jdkirkwood opened this issue Apr 22, 2023 · 6 comments
Closed

Comments

@jdkirkwood
Copy link

jdkirkwood commented Apr 22, 2023

Hi,

233a818 in release 3.0.37 re-introduces asyncio.get_event_loop() which was deprecated and removed in a775996 earlier in the same release.

My Python 3.10 venv fails with prompt-toolkit==3.0.38, but a similar Python 3.8 venv is ok.
Downgrading to prompt-toolkit==3.0.36 allows my Python 3.10 venv to run normally.

(#1726 starts with a different issue but has comments/links directly related to this issue).

2023-04-22 12:34:49,307 18523 WARNING xxx py.warnings: xxx/venv/lib/python3.10/site-packages/prompt_toolkit/application/application.py:955: DeprecationWarning: There is no current event loop
...
  File "zzz/shell.py", line 91, in ipython
    start_ipython(argv=[], user_ns=local_vars)
  File "xxx/venv/lib/python3.10/site-packages/IPython/__init__.py", line 124, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "xxx/venv/lib/python3.10/site-packages/traitlets/config/application.py", line 1043, in launch_instance
    app.start()
  File "xxx/venv/lib/python3.10/site-packages/IPython/terminal/ipapp.py", line 318, in start
    self.shell.mainloop()
  File "xxx/venv/lib/python3.10/site-packages/IPython/terminal/interactiveshell.py", line 887, in mainloop
    self.interact()
  File "xxx/venv/lib/python3.10/site-packages/IPython/terminal/interactiveshell.py", line 872, in interact
    code = self.prompt_for_code()
  File "xxx/venv/lib/python3.10/site-packages/IPython/terminal/interactiveshell.py", line 811, in prompt_for_code
    text = self.pt_app.prompt(
  File "xxx/venv/lib/python3.10/site-packages/prompt_toolkit/shortcuts/prompt.py", line 1035, in prompt
    return self.app.run(
  File "xxx/venv/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 955, in run
    loop = asyncio.get_event_loop()
@jdkirkwood
Copy link
Author

jdkirkwood commented May 1, 2023

Ubuntu 22.04 is packaged with Python 3.10.6, but, for example, other distributions could be at 3.10.11.
The asyncio DeprecationWarning on get_event_loop() is removed in Python 3.10.9, but it will return in the future.
python/cpython@87f9b1d

@razvanioan
Copy link

I can confirm that the depreciation warning is still there on 3.0.38
Same Python 3.10.6 installed on Ubuntu 22.04 LTS
Package included in (jupyter) notebook raises this one

@LordGrimmauld
Copy link

LordGrimmauld commented Nov 10, 2023

Update: It seems not just Ubuntu is affected. I am running xonsh on Fedora 39 which now also ships Python 3.12.
Manually applying the fix doronz88@a54890a mentioned in #1798 into the installed libs at least shuts up the deprecation warning and seems to work perfectly, at least from the little testing i did.

@jonathanslenders
Copy link
Member

jonathanslenders commented Nov 10, 2023

It think it should have been fixed by this PR: #1782
I also released prompt_toolkit 3.0.40
Let me know if it still does not fix the issue.

@LordGrimmauld
Copy link

thank you for the official release, seems to have done exactly what i patched in by hand looking at the diffs on my install for the relevant file. Deprecation warning is and stays gone.

@jdkirkwood
Copy link
Author

#1806 works for me too. Many thanks @jonathanslenders

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

No branches or pull requests

4 participants