16
from streamlit.errors import StreamlitAPIException
18
e = RuntimeError("This exception message is awesome!")
21
e = StreamlitAPIException(
23
Cannot hash object of type `_thread.lock`, found in the return value of
26
While caching the return value of `get_data()`, Streamlit encountered an
27
object of type `_thread.lock`, which it does not know how to hash.
29
To address this, please try helping Streamlit understand how to hash that type
30
by passing the `hash_funcs` argument into `@st.cache`. For example:
33
@st.cache(hash_funcs={_thread.lock: my_hash_func_that_is_some_riduculously_long_name})
38
If you don't know where the object of type `_thread.lock` is coming
39
from, try looking at the hash chain below for an object that you do recognize,
40
then pass that to `hash_funcs` instead:
43
Object of type _thread.lock: <unlocked _thread.lock object at 0x1392ad690>
44
Object of type builtins.tuple: ('I am another ridiculously long string that will take up space', <unlocked _thread.lock object at 0x1392ad690>)
45
Object of type builtins.dict: {'I am another ridiculously long string that will take up space': <unlocked _thread.lock object at 0x1392ad690>}
46
Object of type builtins.tuple: ('I am a ridiculously long string that will take up space', {'I am another ridiculously long string that will take up space': <unlocked _thread.lock object at 0x1392ad690>})
47
Object of type builtins.dict: {'I am a ridiculously long string that will take up space': {'I am another ridiculously long string that will take up space': <unlocked _thread.lock object at 0x1392ad690>}}
51
Please see the `hash_funcs` [documentation](https://docs.streamlit.io/library/advanced-features/caching#the-hash_funcs-parameter)