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

TypeError: 'set' object is not subscriptable #38

Open
jackL999 opened this issue Sep 3, 2021 · 3 comments
Open

TypeError: 'set' object is not subscriptable #38

jackL999 opened this issue Sep 3, 2021 · 3 comments

Comments

@jackL999
Copy link

jackL999 commented Sep 3, 2021

Ubuntu 20.04.3 LTS
Python 3.8.10

json2cmake generates the following error

Traceback (most recent call last):
File "/home/jk2/.local/bin/json2cmake", line 8, in
sys.exit(main())
File "/home/jk2/.local/lib/python3.8/site-packages/json2cmake/init.py", line 223, in main
database.write(args.outfile, name=args.name)
File "/home/jk2/.local/lib/python3.8/site-packages/json2cmake/init.py", line 122, in write
name = os.path.basename(os.path.commonprefix(files).rstrip("/_"))
File "/usr/lib/python3.8/genericpath.py", line 76, in commonprefix
if not isinstance(m[0], (list, tuple)):
TypeError: 'set' object is not subscriptable

@yifengyou
Copy link

edit /home/jk2/.local/lib/python3.8/site-packages/json2cmake/init.py

modify

name = os.path.basename(os.path.commonprefix(list(files)).rstrip("/_"))

owinebar added a commit to owinebar/json2cmake that referenced this issue Jul 3, 2023
@owinebar
Copy link

owinebar commented Jul 3, 2023

Looks like the author has not been active since 2021, but I submitted a pull request with this modification anyway.

@robertlipe
Copy link

Awesome. Thank you. This fixes the same crash on MacOS, too.

It then bombed out on directories with spaces in names, but this is far, far from the first program with that issue. That's further than I'd hoped to get extracting an ESP32 build from PlatformIO and trying to shove it into Cmake.

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

4 participants