Getting TypeError('{!r} is not a callable object in Streamlit Extra Function Explorer

I am using streamlit-extra library’s function_explorer

import streamlit as st
from streamlit_extras.function_explorer import function_explorer

def foo(path):


And I don’t know why I am getting this error:

2022-12-17 00:22:07.918 Uncaught app exception
Traceback (most recent call last):
  File "C:\Users\Adarsh\miniconda3\lib\site-packages\streamlit\runtime\scriptrunner\", line 564, in _run_script
    exec(code, module.__dict__)
  File "D:\Work\Machine Learning\Projects\Python DSA\", line 7, in <module>
  File "C:\Users\Adarsh\miniconda3\lib\site-packages\streamlit\runtime\", line 311, in wrapped_func
    result = non_optional_func(*args, **kwargs)
  File "C:\Users\Adarsh\miniconda3\lib\site-packages\streamlit_extras\function_explorer\", line 37, in function_explorer
    args = get_arg_details(func)
  File "C:\Users\Adarsh\miniconda3\lib\site-packages\streamlit_extras\function_explorer\", line 12, in get_arg_details
    signature = inspect.signature(func)
  File "C:\Users\Adarsh\miniconda3\lib\", line 3113, in signature
    return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
  File "C:\Users\Adarsh\miniconda3\lib\", line 2862, in from_callable
    return _signature_from_callable(obj, sigcls=cls,
  File "C:\Users\Adarsh\miniconda3\lib\", line 2261, in _signature_from_callable
    raise TypeError('{!r} is not a callable object'.format(obj))
TypeError: None is not a callable object

I am using Streamlit 1.15.2 and streamlit-extras 0.2.4 on Python 3.9.15.
Any solution?

Call function_explorer with a callable as argument instead of None.

@Goyo I don’t understand, can you explain how to do that?

def my_func(input1, input2):
    return input1+input2

my_func is a callable object.

my_func(x,y) is the output from that object

Don’t pass an argument to your function that you want to explore:


function_explorer looks at the function itself. It will generate widgets into which you can pass the inputs.

Give function_explorer your function foo and only foo (no arguments, no parentheses)

(I see you deleted your post just now, so I’m guessing you got it. :smiley: )

Yeah I got it :sweat_smile: