Skip to content

Single-quoted keys make pyscript fail silently. (TOML) #2372

@gresm

Description

@gresm

Checklist

  • I added a descriptive title
  • I searched for other issues and couldn't find a solution or duplication
  • I already searched in Google and didn't find any good information or help

What happened?

When using config.toml with something like this:

[files]
'file.py' = ""

Pyscript won't finish loading itself.
Something similar was discussed in #1700, but the main two differences are:

  1. It's a valid TOML syntax
  2. It fails silently - no error message are visible in the dev console.

What could happen instead:

  1. Pyscript parses the config file correctly (best scenario)
  2. Pyscript throws an error indicating "malfolmed" config (quite good scenario)
  3. The documentation indicates that supported TOML syntax is only a subset (quite bad solution - what subset?)

What browsers are you seeing the problem on? (if applicable)

No response

Console info

[Literarly empty dev console, it's less empty when pyscript loads properly.]

Additional Context

After investigating this a bit more, I discoverd that pyscript uses two different TOML parsers for loading the TOML files:

  1. tomlify-j0.4 - apparently implementation of TOML v0.4, quite old and it's unclear to me whether it supports single quoted keys.
  2. basic-toml - it's used by polyscript and seems to implement a custom subset of TOML.

I don't know which one of them is the culprit, but wouldn't it better to switch to one, but newer library?

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't workingtype: featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions