Doctring ERROR: module 'ast' has no attribute 'unparse'
Closed this issue · 3 comments
gcaria commented
Hi,
after some environment changes (which I am unable to track down) I am not getting this error when using :Docstring
in vim.
Doctring ERROR: module 'ast' has no attribute 'unparse'
Do you have any suggestion on how to debug this?
I've tried opening python and calling ast.unparse
but that does not give me an error.
pixelneo commented
Hello, you can start by removing this try/except.
It will fail and show you the whole traceback.
gcaria commented
Sorry for the slow reply, this is what I get with the full traceback:
Error detected while processing function vimpythondocstring#Full:
line 1:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/ubuntu/.vim/bundle/vim-python-docstring/autoload/../python/pydocstring.py", line 265, in full_docstring
self.obj_controller.write_docstring(print_hints=print_hints)
File "/home/ubuntu/.vim/bundle/vim-python-docstring/autoload/../python/pydocstring.py", line 210, in write_docstring
args, returns, yields, raises = self._process_tree(tree)
File "/home/ubuntu/.vim/bundle/vim-python-docstring/autoload/../python/pydocstring.py", line 202, in _process_tree
v.visit(tree)
File "/usr/lib/python3.8/ast.py", line 371, in visit
return visitor(node)
File "/usr/lib/python3.8/ast.py", line 379, in generic_visit
self.visit(item)
File "/usr/lib/python3.8/ast.py", line 371, in visit
return visitor(node)
File "/home/ubuntu/.vim/bundle/vim-python-docstring/autoload/../python/asthelper.py", line 113, in visit_FunctionDef
self._handle_functions(node)
File "/home/ubuntu/.vim/bundle/vim-python-docstring/autoload/../python/asthelper.py", line 88, in _handle_functions
type_hint = ast.unparse(arg.annotation)
AttributeError: module 'ast' has no attribute 'unparse'
Since this is calling python3.8 I think there is a mismatch with the python version vim calls and the python version I normally use.
pixelneo commented
Honestly, I don't know, it seems to me like an issue with the ast
module. I suggest trying it out with different python version (3.9.13).