How to solve toml.decoder.TomlDecodeError: Key group not on a line by itself. (line 1 column 1 ...) error when calling streamlit package?
Asked Answered
M

6

5

I just installed the streamlit package. When I try to run 'streamlit hello' I get the following error:

(base) C:\>streamlit hello Traceback (most recent call last): 
File "c:\users\s158539\appdata\local\continuum\anaconda3\lib\runpy.py", 
  line 193, in _run_module_as_main "__main__", mod_spec) 
File "c:\users\s158539\appdata\local\continuum\anaconda3\lib\runpy.py", 
  line 85, in _run_code exec(code, run_globals) 
File "C:\Users\s158539\AppData\Local\Continuum\anaconda3\Scripts\streamlit.exe\__main__.py", 
  line 5, in <module> 
File "c:\users\s158539\appdata\local\continuum\anaconda3\lib\site-packages\streamlit\__init__.py", 
  line 121, in <module> from streamlit.DeltaGenerator import DeltaGenerator as _DeltaGenerator 
File "c:\users\s158539\appdata\local\continuum\anaconda3\lib\site-packages\streamlit\DeltaGenerator.py", 
  line 33, in <module> from streamlit import caching 
File "c:\users\s158539\appdata\local\continuum\anaconda3\lib\site-packages\streamlit\caching.py", 
  line 38, in <module> from streamlit.hashing import CodeHasher 
File "c:\users\s158539\appdata\local\continuum\anaconda3\lib\site-packages\streamlit\hashing.py", 
  line 36, in <module> from streamlit.folder_black_list import FolderBlackList 
File "c:\users\s158539\appdata\local\continuum\anaconda3\lib\site-packages\streamlit\folder_black_list.py", 
  line 39, in <module> if config.get_option("global.developmentMode"): 
File "c:\users\s158539\appdata\local\continuum\anaconda3\lib\site-packages\streamlit\config.py", 
  line 94, in get_option parse_config_file() 
File "c:\users\s158539\appdata\local\continuum\anaconda3\lib\site-packages\streamlit\config.py", 
  line 877, in parse_config_file _update_config_with_toml(file_contents, filename) 
File "c:\users\s158539\appdata\local\continuum\anaconda3\lib\site-packages\streamlit\config.py", 
  line 799, in _update_config_with_toml parsed_config_file = toml.loads(raw_toml) 
File "c:\users\s158539\appdata\local\continuum\anaconda3\lib\site-packages\toml\decoder.py", 
  line 379, in loads original, pos) toml.decoder.TomlDecodeError: Key group not on a line by itself. (line 1 column 1 char 

Does anyone know how to solve this error?

Thank you in advance!

Maharaja answered 19/1, 2020 at 15:7 Comment(3)
Seems like its uphappy with your config file, did you edit it? if you did it most likely is something about how it was edited. could you edit your entry to include the contents of the config toml based file.Juggins
there is a toml validator here: toml-lint.com Try feeding it the contents of your config file.Juggins
I have the same error. How do I find the config toml based file?Iodoform
P
5

I also got the same error while I tried to run the 'streamlit' command.

So, what I did is track in the code entirely to see from where I can find this 'config.toml' and simply deleted the file.

The path for 'config.toml' file in Windows is: C:users/{username}/.streamlit/config.toml

Delete this file and it will solve the error.

Pelagias answered 3/3, 2021 at 8:53 Comment(0)
L
3

Just delete the config.toml file which can be found in the directory where you have installed streamlit.

Legalize answered 19/8, 2020 at 18:39 Comment(0)
K
3

If you are not able to locate your .streamlit directory

Run streamlit cache clear

Output :

Nothing to clear at {Username}\{path}\.streamlit\cache.

You will get output similar to this which will tell you where is your .streamlit directory exactly.

Take this path before the cache part

cd {Username}\{path}\.streamlit

You'll be able to see config.toml here just delete that file.

Koralie answered 28/2, 2022 at 18:31 Comment(0)
I
1

The Streamlit forum has this discussion topic: https://discuss.streamlit.io/t/toml-docoder-error/1400/10 that discusses this. Hope this helps!

Imamate answered 22/1, 2020 at 0:43 Comment(0)
M
1

delete the content of config.toml file which is in C:\Users\username.streamlit

Morose answered 23/12, 2021 at 12:22 Comment(0)
T
0

Do you have a setup.sh file? What's the content inside it? maybe you will just have to put the content of setup.sh everything in 1 line like this

[server]\nheadless = true\nenableCORS=false\nport = \n

my problem was similar, not exactly like this. so I hope it works!

Tutu answered 14/8, 2021 at 23:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.