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

Using tree-sitter-languages get_languages("java") seeing: "TypeError: __init__() takes exactly 1 argument (2 given)" #1

Open
jwmatthews opened this issue Sep 14, 2024 · 1 comment

Comments

@jwmatthews
Copy link
Owner

I am testing out usage of https://pypi.org/project/tree-sitter-languages/ to avoid building the language parser.
As I'm running a simple test I can't invoke def get_language(language)

Example

$ python3 java_scope_finder.py ./data/Example.java 7
Traceback (most recent call last):
  File "/Users/jmatthews/git/jwmatthews/treesitter_example/java_scope_finder.py", line 263, in <module>
    main()
  File "/Users/jmatthews/git/jwmatthews/treesitter_example/java_scope_finder.py", line 250, in main
    language = get_language('java')
               ^^^^^^^^^^^^^^^^^^^^
  File "tree_sitter_languages/core.pyx", line 14, in tree_sitter_languages.core.get_language
TypeError: __init__() takes exactly 1 argument (2 given)

Looks like tree-sitter-languages last release '1.10.2' is not compatible with a newer 'tree-sitter'.

Workaround I ended up with is to downgrade tree-sitter.

$ cat requirements.txt 
tree-sitter==0.21.3
tree-sitter-languages==1.10.2
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

1 participant