Coding-with-Adam / response-reporting-dashboard

4 stars 1 forks source link

TypeError: string indices must be integers #17

Closed JorgeMiguelGomes closed 3 months ago

JorgeMiguelGomes commented 4 months ago

When trying to run locally @supernyv's branch I get the following error:


  File "/RAPID_RESPONSE_SYSTEM/response-reporting-dashboard/app.py", line 9, in <module>
    app = Dash(
  File "RAPID_RESPONSE_SYSTEM/response-reporting-dashboard/rapidresponse/lib/python3.9/site-packages/dash/dash.py", line 545, in __init__
    self.init_app()
  File "RAPID_RESPONSE_SYSTEM/response-reporting-dashboard/rapidresponse/lib/python3.9/site-packages/dash/dash.py", line 623, in init_app
    self.enable_pages()
  File "RAPID_RESPONSE_SYSTEM/response-reporting-dashboard/rapidresponse/lib/python3.9/site-packages/dash/dash.py", line 2130, in enable_pages
    _import_layouts_from_pages(self.config.pages_folder)
  File "RAPID_RESPONSE_SYSTEM/response-reporting-dashboard/rapidresponse/lib/python3.9/site-packages/dash/_pages.py", line 435, in _import_layouts_from_pages
    spec.loader.exec_module(page_module)
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "RAPID_RESPONSE_SYSTEM/response-reporting-dashboard/pages/internal.py", line 52, in <module>
    "cellEditorParams": {"values": platforms["platform_name"].values},
TypeError: string indices must be integers```
supernyv commented 4 months ago

Hi @JorgeMiguelGomes, What the error is implying is that "platforms" variable is a string (actually it is a dictionary) : This only happens if your query to the database did not return a pandas dataframe but returned an error (which is a string). In other words, because that line of code depends on a successful setup of the MySQL database, the issue is coming from your local setup of the database (vost_db) with all its tables and the appropriate user (vost_user with password vost)

Coding-with-Adam commented 3 months ago

Closing issue because it's a matter of setting up the MySQL database locally.