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

Configs with values with percent signs (%) can't be loadfile'd-> TypeError #40

Open
gyermolenko opened this issue May 26, 2020 · 0 comments

Comments

@gyermolenko
Copy link

gyermolenko commented May 26, 2020

Yaml values containing % can cause TypeErrors.

$ cat file.yaml
uri: "amqp://localhost:5672/%2F"

$ python
Python 3.7.4 (default, Oct  1 2019, 17:17:01)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pymlconf import Root
>>> Root().loadfile('file.yaml')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../site-packages/pymlconf/models.py", line 236, in loadfile
    loadedyaml = yaml_.load(filename, self.context)
  File ".../site-packages/pymlconf/yaml_.py", line 30, in load
    return loads(f.read(), context)
  File ".../site-packages/pymlconf/yaml_.py", line 20, in loads
    str_data = preprocess(str_data, context)
  File ".../site-packages/pymlconf/yaml_.py", line 15, in preprocess
    return data % context
TypeError: must be real number, not dict

Because %2F is considered string format specifier (if not escaped, e.g. with another %).

@gyermolenko gyermolenko changed the title Configs with values with percent signs (%) can't be loaded -> TypeError Configs with values with percent signs (%) can't be loadfile'd-> TypeError May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant