Non-fatal error on MacOS
wildwestrom opened this issue · comments
Running:
MacOS 12
zsh 5.8 (x86_64-apple-darwin21.0)
Seems like a problem with readlink on MacOS.
Perhaps the GNU version will work. Will test soon.
$ ./antp.sh import
readlink: illegal option -- f
usage: readlink [-n] [file ...]
Traceback (most recent call last):
File "/Users/main/homebrew/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 188, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/Users/main/homebrew/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 147, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/Users/main/homebrew/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 158, in _get_module_details
code = loader.get_code(mod_name)
File "<frozen importlib._bootstrap_external>", line 983, in get_code
File "<frozen importlib._bootstrap_external>", line 913, in source_to_code
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/Users/main/Code/community/AnkiNoteTypes/antp/__main__.py", line 23
match sys.argv[1]:
^
SyntaxError: invalid syntax
Seems like a problem with readlink on MacOS.
It is possible.
Also make sure to run Python 3.10.
I did get further by using python 3.10.
brew link --overwrite python@3.10
$ ./antp.sh import
readlink: illegal option -- f
usage: readlink [-n] [file ...]
0: Japanese sentences
1: General
2: Japanese Mined Sentences (cyphar)
3: Japanese words
4: Japanese fallback
5: Japanese kana
Select item number:
It should work even if readlink fails as long as you're in the same directory. If you launch antp.sh
from a different directory (e.g. by linking it in your PATH), it won't work. Ideally you need to figure out why your operating system doesn't provide a proper version of readlink.
Yeah, the program seems to run perfectly fine even with the error.
The MacOS coreutils are based on the BSD coreutils I believe, this is why it doesn't have as many options.
Just pulled in the commit. No errors when running within the project directory.