Skip to content

Fix empty file generation for create-settings-file#349

Open
ppradyoth wants to merge 2 commits into
protectai:mainfrom
ppradyoth:fix/empty-settings-file
Open

Fix empty file generation for create-settings-file#349
ppradyoth wants to merge 2 commits into
protectai:mainfrom
ppradyoth:fix/empty-settings-file

Conversation

@ppradyoth
Copy link
Copy Markdown

I noticed that when running modelscan create-settings-file, the generated .toml configuration file is totally empty instead of containing the default settings.

The issue seems to be that in DEFAULT_SETTINGS, Property objects were used as dictionary keys under formats instead of strings. When tomlkit.dumps() attempts to serialize it, it silently raises a TypeError and leaves the opened file empty.

I appended .value to these enum members to ensure they are standard strings. Tested locally and the TOML generates perfectly now. Let me know if you prefer a different approach!

Fixes #327

Pradyoth P added 2 commits May 25, 2026 17:40
Fixes protectai#327

When generating the default TOML settings file, the DEFAULT_SETTINGS dictionary mistakenly used Property objects as keys instead of strings. This caused tomlkit.dumps() to throw a TypeError under the hood, which was silently swallowed, resulting in an empty configuration file being written. Using the .value string representation fixes the serialization.
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

Successfully merging this pull request may close these issues.

No content of the configuration file was found.

1 participant