@cvp said in Correct way to call Pythonista script from within a Shortcuts workflow?:
TypeError: unhashable type: 'list'
The "TypeError: unhashable type: 'list'" error message in Python occurs when you try to use a mutable object (such as a list) as a key in a dictionary. Since dictionaries use keys to index values, keys must be hashable objects, meaning they must be immutable (i.e. their value cannot be changed). Lists are mutable, so they cannot be used as dictionary keys. To fix the error, use an immutable object like a tuple, string, or number as the dictionary key instead.
To resolve the TypeError: unhashable type: 'list' error, you need to use an immutable object as a key in a dictionary instead of a mutable one like a list. For example, you can use tuples, strings, or numbers as keys, which are all hashable objects.
d = {[1, 2, 3]: "list_key"} //Using a list as a key in a dictionary
//This will raise the TypeError: unhashable type: 'list' error
d = {(1, 2, 3): "tuple_key"} //Using a tuple as a key in a dictionary
//This will work fine as tuples are hashable