Toml decoder error (TomlDecodeError)

its Working โ€ฆ:slight_smile:

2 Likes

Hi Simon,

I encountered this issue after I deploy at heroku.
why heroku is able to overwrite thyis?
Thanks

I am having this issue after I edit the config.toml file as shown in the instructions on how to turn off magic printing. I only changed one line

magicEnabled = true
to
magicEnabled = false

but now I get the decode error. The error persists even after changing back to its original text. I can delete the file as suggested, but then I lose the ability to turn magic off. Maybe someone could suggest another way to prevent it from printing automatically.

Thank you so much eriktuck!!! You just saved my life. I messed up my system when trying to figure out how to present the local host to a online server with Heroku, and weirdly the codes failed to run with the same problem. I have been stayed up all night cuz I need to do a presentation with streamlit today. My mind just exploded for million times to fix the situation, and finally your way works!! Again thank you so much Savior!! Hope you have a wonderful day!

Getting the following error. Any solutions?
toml.decoder.TomlDecodeError: Key name found without value

Thanks a lot, @eriktuck. Moving the file to another directory solved it for me.

have u found any solution to this problem

I will have to change what?

Iโ€™m on windows system and I still couldnโ€™t find the file and solve the problem

so how windows user delay with this problem

Hey I thought my error is also similar to this, so I am including the link of my error:

The contents of my setup.sh file are:

mkdir -p ~/.streamlit/
echo "\
[server]\n\
port = $PORT\n\
enableCORS = false\n\
headless = true\n\
\n\
" > ~/.streamlit/config.toml

My app is running perfectly on local machine. But it is getting the error described in the above link when I try to deploy it on heroku.

If anybody could help me solving this.

just delete config.toml file
it will create again when you run your app.py

rm ~/.streamlit/config.toml
then run your app.py

1 Like

hi
In windows, go to the C:/Windows/Users/%profile name%/.streamlit, delete the toml files and restart streamlit app. it works fine.

1 Like

thanks it worked by removing the toml file

Hey @eriktuck, that was very helpful, what i found additionally is the setup file for heroku deployment has got this entry, which is creating these toml files -

mkdir -p ~/.streamlit/
echo "
[general]\n
email = โ€œyour-email@domain.comโ€\n
" > ~/.streamlit/credentials.toml
echo "
[server]\n
headless = true\n
enableCORS=false\n
port = $PORT\n
" > ~/.streamlit/config.toml

Thank you so much. Deleting the contents of the config.toml file finally resolved the issue.

2 Likes

Thanks a lot @eriktuck , you helped me a lot

1 Like

Wao, Thank you bro, wonderfull !

For those who fail the deployment on Heroku. You might found several tutorials suggesting the setup.sh, but please have a look when you copy-paste the code. I deploy the website without deleting the config.toml file. Here are the steps:

  1. In several tutorials, in the setup.sh, you might see something like this:
mkdir -p ~/.streamlit/
echo "
[general]n
email = "your-email@domain.com"n
" > ~/.streamlit/credentials.toml
echo "
[server]n
headless = truen
enableCORS=falsen
port = $PORTn
" > ~/.streamlit/config.toml

The code creates a .streamlit folder and the config.toml inside the folder. However, your script doesnโ€™t exist in the folder, but at the same level as the folder is. Therefore, Heroku build the app with the default config.toml setting. Therefore, create the folder yourself (in this case .streamlit), putting those .py files and your data inside the folder. Finally, delete the mkdir -p ~/.streamlit/ inside the setup.sh.

  1. The setup.sh and the Procfile are at the same level as the .streamlit folder. In this step, youโ€™ll need to make sure the streamlit run .streamlit/app.py command opens your app, and puts it inside the Procfile.

[Procfile]

web: sh setup.sh && streamlit run .streamlit/app.py

Wrap up:

[setup.sh]

echo "\
[general]\n\
email = \"your-email@domain.com\"\n\
" > ~/.streamlit/credentials.toml
echo "\
[server]\n\
headless = true\n\
enableCORS=false\n\
port = $PORT\n\
" > ~/.streamlit/config.toml

[Procfile]
web: sh setup.sh && streamlit run .streamlit/app.py

Thank you so much.