Dash() got an unexpected keyword argument 'request_pathname_prefix'

I have no idea how i got into this situation. This should be a valid keyword argument, anyidea what i should do?

File "c:\Users\MichaelAF\Documents\facts_mobile_api\facts_marketplace_host\facts_marketplace_host\Reports\employee_time_.py", line 701, in <module>
    app = dash.Dash(request_pathname_prefix = '/test1/',
  File "C:\Users\MichaelAF\.conda\envs\env\lib\site-packages\dash\dash.py", line 241, in __init__
    raise TypeError(
TypeError: Dash() got an unexpected keyword argument 'request_pathname_prefix'

I guess seeing code context helps

def  import_reports():
     app_list = {}

     for f in file_list:

        mod = importlib.import_module('Reports.'+f) 

        #the correct url path is in the dash.config

        app_list.update({mod.app.config.get('requests_pathname_prefix')[:-1]:mod.app.server})

        print(mod.app.config.get('requests_pathname_prefix'))
    
        return app_list

# file1
app = dash.Dash(request_pathname_prefix = '/test/',
                external_stylesheets=external_stylesheets)

# file2
app = dash.Dash(request_pathname_prefix = '/test1/',
                external_stylesheets=external_stylesheets)



mounts = import_reports()

#need to fix TypeError: Dash() got an unexpected keyword argument 'request_pathname_prefix'
server = DispatcherMiddleware(app, 
                                mounts = mounts )

You have spelled the keyword incorrectly. It is requests_pathname_prefix, not request_pathname_prefix. A proper IDE, e.g. Pycharm, will help you detect this kind of errors.

1 Like