Jepetto
Jepetto

Reputation: 51

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

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!

Upvotes: 5

Views: 24251

Answers (6)

Vidhi Gupta
Vidhi Gupta

Reputation: 31

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.

Upvotes: 3

Wais Yousofi
Wais Yousofi

Reputation: 19

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

Upvotes: 1

Pimpwhippa
Pimpwhippa

Reputation: 37

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!

Upvotes: 0

Dinesh
Dinesh

Reputation: 151

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.

Upvotes: 5

Rutwik Deshmukh
Rutwik Deshmukh

Reputation: 43

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

Upvotes: 3

user62241
user62241

Reputation: 154

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

Upvotes: 1

Related Questions