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

Exception from tree-sitter on every run #14

Open
npt opened this issue Dec 19, 2024 · 5 comments
Open

Exception from tree-sitter on every run #14

npt opened this issue Dec 19, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@npt
Copy link

npt commented Dec 19, 2024

I get this exception whenever running grep-ast:

Traceback (most recent call last):
  File "/home/nick/.local/bin/gast", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/nick/.local/pipx/venvs/grep-ast/lib/python3.11/site-packages/grep_ast/main.py", line 60, in main
    process_filename(fname, args)
  File "/home/nick/.local/pipx/venvs/grep-ast/lib/python3.11/site-packages/grep_ast/main.py", line 88, in process_filename
    tc = TreeContext(
         ^^^^^^^^^^^^
  File "/home/nick/.local/pipx/venvs/grep-ast/lib/python3.11/site-packages/grep_ast/grep_ast.py", line 47, in __init__
    parser = get_parser(lang)
             ^^^^^^^^^^^^^^^^
  File "tree_sitter_languages/core.pyx", line 19, in tree_sitter_languages.core.get_parser
  File "tree_sitter_languages/core.pyx", line 14, in tree_sitter_languages.core.get_language
TypeError: __init__() takes exactly 1 argument (2 given)

This occurs when using both Python 3.12 and 3.11 (I tried 3.11 based on some of the comments on #7, but I don't know if/how this is related to that issue).
Environment: Ubuntu 24.04, installing using pipx, using the system Python (or Python 3.11 from the deadsnakes PPA).

@paul-gauthier
Copy link
Collaborator

Thanks for trying aider and filing this issue.

Did you install aider a few times, using different install methods? It looks like you are running aider with the wrong dependencies.

This doc may be helpful:

https://aider.chat/docs/troubleshooting/imports.html

@npt
Copy link
Author

npt commented Dec 19, 2024

This is an issue with grep-ast, not aider. Aider works great for me.

@npt
Copy link
Author

npt commented Dec 19, 2024

I just tried the grep-ast recommended install method of python -m pip install git+https://github.com/paul-gauthier/grep-ast.git in a venv, with both Python 3.11 and 3.12. Same error.

@paul-gauthier paul-gauthier added the bug Something isn't working label Dec 20, 2024
@paul-gauthier
Copy link
Collaborator

Sorry about that. You probably need to pip install tree-sitter==0.21.3. I will update the requirements to make this automatic.

@npt
Copy link
Author

npt commented Dec 20, 2024

After running

pipx install grep-ast
pipx runpip grep-ast install tree-sitter==0.21.3

grep-ast indeed works. However, it prints the warning

/home/nick/.local/pipx/venvs/grep-ast/lib/python3.12/site-packages/tree_sitter/__init__.py:36: FutureWarning: Language(path, name) is deprecated. Use Language(ptr, name) instead.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants