wookayin / vim-autoimport

A vim plugin for adding import statements (for python and more) without LSP
https://work.in.progress
25 stars 5 forks source link

An attribute error occurs in python3.9 #4

Closed sungminoh closed 3 years ago

sungminoh commented 3 years ago

https://github.com/wookayin/vim-autoimport/blob/3368fa421f921300cd56e1e4dc35ab19b6b2ebb0/python3/vim_autoimport/managers/python.py#L224

This line causes an error in python3.9

Error detected while processing function <SNR>128_ImportSymbol[7]..autoimport#
import_symbol[1]..provider#python3#Call:
line   18:
Error invoking 'python_eval' on channel 4 (python3-script-host):
error caught in request handler 'python_eval ['vim_autoimport.get_manager().im
port_symbol(vim.eval("a:symbol"))']':
Traceback (most recent call last):
  File "/Users/sungminoh/.virtualenvs/leetcode/lib/python3.9/site-packages/pyn
vim/plugin/script_host.py", line 171, in python_eval
    return eval(expr, self.module.__dict__)
  File "<string>", line 1, in <module>
  File "/Users/sungminoh/.vim/plugged/vim-autoimport/python3/vim_autoimport/ma
nagers/__init__.py", line 31, in get_manager
    manager = PythonImportManager()
  File "/Users/sungminoh/.vim/plugged/vim-autoimport/python3/vim_autoimport/ma
nagers/python.py", line 89, in __init__
    self._strategies = self.create_strategies()
  File "/Users/sungminoh/.vim/plugged/vim-autoimport/python3/vim_autoimport/ma
nagers/python.py", line 95, in create_strategies
    BuiltinCTagsStrategy() if find_executable("ctags") else None,
  File "/Users/sungminoh/.vim/plugged/vim-autoimport/python3/vim_autoimport/ma
nagers/python.py", line 226, in __init__
    if _w._loop is None:
AttributeError: 'ThreadedChildWatcher' object has no attribute '_loop'

_w was <class 'asyncio.unix_events.SafeChildWatcher'> that has _loop but it seems not anymore.

wookayin commented 3 years ago

Fixed in 2a55fdd and now it works on python3.9. Thanks for reporting!