Unable to run streamlit file

I am unable to run my app locally .
The error message that I get:
Traceback (most recent call last):
File “C:\Program Files\Python312\Lib\site-packages\toml\decoder.py”, line 511, in loads
ret = decoder.load_line(line, currentlevel, multikey,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Program Files\Python312\Lib\site-packages\toml\decoder.py”, line 778, in load_line
value, vtype = self.load_value(pair[1], strictly_valid)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Program Files\Python312\Lib\site-packages\toml\decoder.py”, line 812, in load_value
raise ValueError(“Empty value is invalid”)
ValueError: Empty value is invalid

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “”, line 198, in _run_module_as_main
File “”, line 88, in run_code
File "C:\Program Files\Python312\Lib\site-packages\streamlit_main
.py", line 20, in
main(prog_name=“streamlit”)
File “C:\Program Files\Python312\Lib\site-packages\click\core.py”, line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Program Files\Python312\Lib\site-packages\click\core.py”, line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File “C:\Program Files\Python312\Lib\site-packages\click\core.py”, line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Program Files\Python312\Lib\site-packages\click\core.py”, line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Program Files\Python312\Lib\site-packages\click\core.py”, line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Program Files\Python312\Lib\site-packages\streamlit\web\cli.py”, line 204, in main_run
bootstrap.load_config_options(flag_options=kwargs)
File “C:\Program Files\Python312\Lib\site-packages\streamlit\web\bootstrap.py”, line 343, in load_config_options
config.get_config_options(force_reparse=True, options_from_flags=options_from_flags)
File “C:\Program Files\Python312\Lib\site-packages\streamlit\config.py”, line 1322, in get_config_options
_update_config_with_toml(file_contents, filename)
File “C:\Program Files\Python312\Lib\site-packages\streamlit\config.py”, line 1200, in _update_config_with_toml
parsed_config_file = toml.loads(raw_toml)
^^^^^^^^^^^^^^^^^^^^
File “C:\Program Files\Python312\Lib\site-packages\toml\decoder.py”, line 514, in loads
raise TomlDecodeError(str(err), original, pos)
toml.decoder.TomlDecodeError: Empty value is invalid (line 3 column 1 char 25)

My source code - Github Link:GitHub - kottarivaibhav/data_science_web_app: This is an Data science web app related to traffic accidents based on my Coursera Project Work

Per the error message, it appears there is some problem parsing your config file. Can you run other apps locally? Create a simple hello world file in the same directory and try to run that.

#hello_world.py
import streamlit as st

st.write("Hello World")

In your terminal, change directory to your project folder and streamlit run hello_world.py to see if it also runs into the same configuration error.

If it does, look at your local and global configuration files to make sure they aren’t corrupt. Maybe even re-save them.

1 Like

It seems you’ve created a custom toml file, and the configuration isn’t correct.
Try launching your app after deleting/renaming the toml file.
Streamlit expects your toml file to be in the path “.streamlit/config.toml”.

Hello mathcatsand,
I cannot run in my VS code . But I can run on a google collab . I guess there is some file/configuration that’s causing the problem .

The toml file corruption is what I am not able to understand . I have not used it anywhere .

Just to give more information , I tried deploying my app in heroku where I had to do certain changes like adding toml file(which I have deleted) but after that I cannot run any streamlit app in my VS code

Hello Kush-ks,
I have deleted mine toml file from folder but I am not still able to solve the problem . Is their any other things I can do to clear the problem .

Also Is their any other editor which I can try other that VS code , since my code is correct , But unable to compile it due to the same error for every streamlit file when run on VS code

First, make sure to check both places for your config file listed in the docs (both the local and global ones). The location of the global one depends on your OS. You can also try creating a new project folder somewhere and running the hello world app from there to test just your global configuration file.

If you’ve deleted your config file in you current project, try creating a new one that is empty.

Also, you could sync your project to GitHub, delete your local copy, and reclone it. (I’m not sure how), but maybe you a hidden file doing something weird?

If all that fails, perhaps try creating a clean Python environment and reinstalling Streamlit.

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