Attribute Error: ‘str’ object has no attribute ‘items’

If you’re creating a debugging post, please include the following info:

  1. Are you running your app locally or is it deployed?
  2. If your app is deployed:
    a. Is it deployed on Community Cloud or another hosting platform?
    b. Share the link to the public deployed app.
  3. Share the link to your app’s public GitHub repository (including a requirements file).
  4. Share the full text of the error message (not a screenshot).
  5. Share the Streamlit and Python versions.

def _update_config_with_toml(raw_toml: str, where_defined: str) → None:
“”"Update the config system by parsing this string.

This should only be called from get_config_options.

Parameters
----------
raw_toml : str
    The TOML file to parse to update the config values.
where_defined : str
    Tells the config system where this was set.

"""
import toml

parsed_config_file = toml.loads(raw_toml)

for section, options in parsed_config_file.items():
    if isinstance(options, dict):
        for name, value in options.items():
            value = _maybe_read_env_variable(value)
            _set_option(f"{section}.{name}", value, where_defined)
    else:
        # Handle the case where the 'options' is not a dictionary
        print(f"Skipping section '{section}' as it is not a dictionary: {options}")

How are you calling this function?

I installed package locally through tar file or whl and I was getting this error, if you are facing same issues updat e funtion like above , probably line 1203 in config file of package . It will work.
If error originated from any other reason I am not sure if above solution will work.
I.m modified existing function. Not created new one

I am not facing any issues, just trying to understand yours…

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.