Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message should be clearer when there's a syntax error in the TOML file #1256

Open
tvst opened this issue Mar 25, 2020 · 0 comments
Open

Error message should be clearer when there's a syntax error in the TOML file #1256

tvst opened this issue Mar 25, 2020 · 0 comments
Labels

Comments

@tvst
Copy link
Collaborator

@tvst tvst commented Mar 25, 2020

Steps to reproduce

  1. Create config.toml that has a syntax error, like this:
server.port=
  1. Run a script with Streamlit (e.g. streamlit hello)

Expected behavior:

We should see an error like this on the console:

ValueError: Error parsing ~/.streamlit/config.toml. This is most likely due to a syntax error in the TOML file. Please fix it and try again.

[Original exception from the toml parser goes here]

...where the "original exception" is the part of the error below that ends with toml.decoder.TomlDecodeError: Empty value is invalid (line 1 column 1 char 0).

Actual behavior:

We see this error on the console, which is not super clear:

Traceback (most recent call last):
  File "/home/tvst/.local/share/virtualenvs/py3.7-gDeIkMOX/lib/python3.7/site-packages/toml/decoder.py", line 456, in loads
    multibackslash)
  File "/home/tvst/.local/share/virtualenvs/py3.7-gDeIkMOX/lib/python3.7/site-packages/toml/decoder.py", line 725, in load_line
    value, vtype = self.load_value(pair[1], strictly_valid)
  File "/home/tvst/.local/share/virtualenvs/py3.7-gDeIkMOX/lib/python3.7/site-packages/toml/decoder.py", line 739, 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 "/home/tvst/.local/share/virtualenvs/py3.7-gDeIkMOX/bin/streamlit", line 5, in <module>
    from streamlit.cli import main
  File "/home/tvst/.local/share/virtualenvs/py3.7-gDeIkMOX/lib/python3.7/site-packages/streamlit/__init__.py", line 103, in <module>
    from streamlit.DeltaGenerator import DeltaGenerator as _DeltaGenerator
  File "/home/tvst/.local/share/virtualenvs/py3.7-gDeIkMOX/lib/python3.7/site-packages/streamlit/DeltaGenerator.py", line 27, in <module>
    from streamlit import caching
  File "/home/tvst/.local/share/virtualenvs/py3.7-gDeIkMOX/lib/python3.7/site-packages/streamlit/caching.py", line 40, in <module>
    from streamlit.hashing import Context
  File "/home/tvst/.local/share/virtualenvs/py3.7-gDeIkMOX/lib/python3.7/site-packages/streamlit/hashing.py", line 40, in <module>
    from streamlit.folder_black_list import FolderBlackList
  File "/home/tvst/.local/share/virtualenvs/py3.7-gDeIkMOX/lib/python3.7/site-packages/streamlit/folder_black_list.py", line 39, in <module>
    if config.get_option("global.developmentMode"):
  File "/home/tvst/.local/share/virtualenvs/py3.7-gDeIkMOX/lib/python3.7/site-packages/streamlit/config.py", line 90, in get_option
    parse_config_file()
  File "/home/tvst/.local/share/virtualenvs/py3.7-gDeIkMOX/lib/python3.7/site-packages/streamlit/config.py", line 888, in parse_config_file
    _update_config_with_toml(file_contents, filename)
  File "/home/tvst/.local/share/virtualenvs/py3.7-gDeIkMOX/lib/python3.7/site-packages/streamlit/config.py", line 810, in _update_config_with_toml
    parsed_config_file = toml.loads(raw_toml)
  File "/home/tvst/.local/share/virtualenvs/py3.7-gDeIkMOX/lib/python3.7/site-packages/toml/decoder.py", line 458, in loads
    raise TomlDecodeError(str(err), original, pos)
toml.decoder.TomlDecodeError: Empty value is invalid (line 1 column 1 char 0)

Is this a regression?

no

Debug info

  • Streamlit version: 0.56.0
  • Python version: 3.7

Additional information

Source: https://discuss.streamlit.io/t/cant-import-streamlit-anymore/2288/2

@tvst tvst added the bug label Mar 25, 2020
@jrhone jrhone added enhancement and removed bug labels Apr 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.