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

AttributeError: 'Null' object has no attribute '_trivia'. Did you mean: 'trivia'? #313

Closed
dimbleby opened this issue Sep 21, 2023 · 0 comments

Comments

@dimbleby
Copy link

dimbleby commented Sep 21, 2023

[dependencies]
[dependencies.foo]
version = ">=1.0.0"

[dependencies.bar]
version = ">=1.0.0"
#!/usr/bin/env python3

from tomlkit.toml_file import TOMLFile

content = TOMLFile("dependencies.toml").read()
content["dependencies"]["foo"] = ">=2.0.0"
Traceback (most recent call last):
  File "/home/dch/bar/./foo.py", line 6, in <module>
    content["dependencies"]["foo"] = ">=2.0.0"
  File "/home/dch/.virtualenvs/foo/lib/python3.10/site-packages/tomlkit/items.py", line 1518, in __setitem__
    self._value[key] = value
  File "/home/dch/.virtualenvs/foo/lib/python3.10/site-packages/tomlkit/container.py", line 630, in __setitem__
    self._replace(old_key, key, value)
  File "/home/dch/.virtualenvs/foo/lib/python3.10/site-packages/tomlkit/container.py", line 649, in _replace
    self._replace_at(idx, new_key, value)
  File "/home/dch/.virtualenvs/foo/lib/python3.10/site-packages/tomlkit/container.py", line 682, in _replace_at
    self._insert_at(i, new_key, value)
  File "/home/dch/.virtualenvs/foo/lib/python3.10/site-packages/tomlkit/container.py", line 412, in _insert_at
    or "\n" in previous_item.trivia.trail
  File "/home/dch/.virtualenvs/foo/lib/python3.10/site-packages/tomlkit/items.py", line 474, in trivia
    return self._trivia
AttributeError: 'Null' object has no attribute '_trivia'. Did you mean: 'trivia'?
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