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

BIDSLayout.get -- TypeError: unhashable type: 'list' #683

Open
oesteban opened this issue Nov 25, 2020 · 1 comment · May be fixed by #684
Open

BIDSLayout.get -- TypeError: unhashable type: 'list' #683

oesteban opened this issue Nov 25, 2020 · 1 comment · May be fixed by #684
Labels

Comments

@oesteban
Copy link
Collaborator

Playing around metadata getters, and after working out a patch for the sibling issue #681, I've found the following related problem:

In [11]: l.get_suffixes()
Out[11]:
['bold',
 'description',
 'epi',
 'magnitude1',
 'participants',
 'phasediff',
 'sbref',
 'T1w']

In [12]: l.get_IntendedFor()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-12-9bcef017758c> in <module>
----> 1 l.get_IntendedFor()

~/workspace/pybids/bids/layout/layout.py in get(self, return_type, target, scope, regex_search, absolute_paths, invalid_filters, **filters)
    678
    679             if return_type == 'id':
--> 680                 results = list(set([x.entities[target] for x in results]))
    681                 results = natural_sort(results)
    682

TypeError: unhashable type: 'list'

In this case, the problem arises from the fact that lists are not hashable for the set, but some IntendedFor has a list inside.

@oesteban oesteban added the bug label Nov 25, 2020
oesteban added a commit to oesteban/pybids that referenced this issue Nov 25, 2020
@oesteban oesteban linked a pull request Nov 25, 2020 that will close this issue
@adelavega
Copy link
Collaborator

Just had this same issue pop up when trying to do get_tasks. Turn out a match for task was a description for said column in participants.json. Probably should exclude dicts/metadata from id type returns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants