-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
In MacOS, we have the following error:
OSError: dlopen(/Users/rf208/inspect4py/inspect4py/resources/python_unix.so, 0x0006): tried: '/Users/rf208/inspect4py/inspect4py/resources/python_unix.so' (not a mach-o file), '/usr/local/lib/python_unix.so' (not a mach-o file), '/usr/lib/python_unix.so' (no such file)
Solution: We need to create a .so file for mac. Steps (following this doc: https://github.com/tree-sitter/py-tree-sitter#usage):
- git clone https://github.com/tree-sitter/tree-sitter-python
- Run:
from tree_sitter import Language, Parser
Language.build_library(
# Store the library in the `build` directory
'my-languages.so',
# Include one or more languages
[
'path_to_cloned_repo/tree-sitter-python'
]
)
- This will create a file called "my-languages.so". Rename to "python_macOS.so"
- Add the file to folder:
inspect4py/resources/ - Change line 1266 in
cli.py:
if sys.platform.startswith("win") or sys.platform.startswith("cygwin"):
language = Language(path_to_languages + os.path.sep + "python_win.so", "python")
else:
language = Language(path_to_languages + os.path.sep + "python_unix.so", "python")
to be
if sys.platform.startswith("win") or sys.platform.startswith("cygwin"):
language = Language(path_to_languages + os.path.sep + "python_win.so", "python")
elif sys.platform.startswith("darwin"):
language = Language(path_to_languages + os.path.sep + "python_macOS.so", "python")
else:
language = Language(path_to_languages + os.path.sep + "python_unix.so", "python")
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working