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

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

Open
micho2 opened this issue May 23, 2024 · 1 comment
Open

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

micho2 opened this issue May 23, 2024 · 1 comment

Comments

@micho2
Copy link

micho2 commented May 23, 2024

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

@orchetect
Copy link

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

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

2 participants