We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello,
Using tomlkit 0.13.2, having a problem when read and rewriting the content. The comments and the indentation disappear.
if not bool(self._config): return None if not os.path.exists(self.path): open(self.path, 'a').close() # Read content of file with open(self.path, 'r', encoding="utf-8") as file: # Read the entire content of the file content = file.read() doc = tomlkit.parse(content) doc.update(self._config) # config Dict from with open(self.path, 'w', encoding="utf-8") as file: file.write(tomlkit.dumps(doc))
Config load
with open(self.path, "r") as file: self._config = tomlkit.load(file).unwrap() return self._config
Here the toml as input
[Publisher] [Publisher.Specifications] Protocol = "MQTTv5" Port = 1166 SendTimePeriod = 20 # seconds TimeGroupPeriod = 200 # milliseconds # ProxyHost = "111.111.111.111" # ProxyPort = 1616
Here the toml as output
[Publisher.Specifications] Protocol = "MQTTv5" Port = 1166 SendTimePeriod = 20 TimeGroupPeriod = 200
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello,
Using tomlkit 0.13.2, having a problem when read and rewriting the content.
The comments and the indentation disappear.
Config load
Here the toml as input
Here the toml as output
The text was updated successfully, but these errors were encountered: