sbhc.py returns with error: ValueError: Unknown type kind 119
Hello, and thanks for the great project!!!
Unfortunately, I get an error when calling sbhc.py on Mail.h It returns with error: File "../SwiftScripting_FromRepo/sbhc.py", line 133, in type_for_type if as_arg and objc_type.kind in object_kinds: File "/Users/mi/.pyenv/versions/myenv/lib/python2.7/site-packages/clang-3.5-py2.7.egg/clang/cindex.py", line 1650, in kind return TypeKind.from_id(self._kind_id) File "/Users/mi/.pyenv/versions/myenv/lib/python2.7/site-packages/clang-3.5-py2.7.egg/clang/cindex.py", line 1542, in from_id raise ValueError,'Unknown type kind %d' % id ValueError: Unknown type kind 119
Any Idea how to fix that?
MacOs: 14.5 Python 2.7.18
Try using python3. I was able to run all the scripts without issue.
I had to update syntax for 3 lines of one of the scripts.
In sbsc.py, lines 38...40:
https://github.com/tingraldi/SwiftScripting/blob/4346eba0f47e806943601f5fb2fe978e2066b310/sbsc.py#L38-L40
had to be changed to this:
name_string = str.replace(name_string, '"', '')
name_string = str.replace(name_string, '-', ' ')
name_string = str.replace(string.capwords(name_string), ' ', '')
This was the method I used to install the clang bindings:
pip3 install clang pip install clang==14
If clang bindings installation fails with an 'externally-managed-environment' error, you can add this flag to the above command:
pip3 install clang pip install clang==14 --break-system-packages
Then this worked on my system (macOS 14.5):
cd ~/Desktop
mkdir sb
cd sb
sdef /System/Applications/Mail.app > Mail.sdef
sdp -fh --basename Mail Mail.sdef
python3 sbhc.py Mail.h
python3 sbsc.py Mail.sdef