tingraldi/SwiftScripting

sbhc.py returns with error: ValueError: Unknown type kind 119

micho2 opened this issue · 1 comments

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:

SwiftScripting/sbsc.py

Lines 38 to 40 in 4346eba

name_string = string.replace(name_string, '"', '')
name_string = string.replace(name_string, '-', ' ')
name_string = string.replace(string.capwords(name_string), ' ', '')

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