-
-
Notifications
You must be signed in to change notification settings - Fork 167
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
Comments in config.ini
are treated as options
#673
Comments
This is a limitation of python's |
Are you sure about that? From my limited understanding in Python, Legendary seems to be mistakenly limiting comments to only begin with the legendary/legendary/lfs/lgndry.py Line 50 in 3963382
I got the same parsing error when I replicated what Legendary does, but in interactive Python:
In contrast, I don't get any errors if I don't override
The # ~/.config/legendary/config.ini
[legendary]
# foo
# foo
log_level = debug |
I honestly can't remember why that's set to |
The point of that change was to not treat comments as actual comments, as when writing to the config file, ConfigParser discards them |
Oh, I see. The issue I linked above seems to complain that after running Is that behavior still prevent in the latest version? And if so, I wonder why? |
Thanks for clarifying. I wasn't aware that Legendary itself managed So I think the only solution to this would be switching to a third-party ini parser that can actually retain comments upon saving the file, like ConfigObj. But if that's not something you're interested at this time, feel free to close this. Otherwise, let me know so I can take a stab at implementing it. |
Sorry, missed this Assuming a 3rd-party parser has no downsides, I don't see why a PR moving to one wouldn't be accepted. Do note however that PRs might take a bit longer to get merged, as the maintainer of this project is busy with other things. Personally, I don't really have an opinion on the matter. As mentioned, if a 3rd party parser is just as easy to use as Python's native one, it'd be fine by me to switch to it instead. On the other hand, to be completely honest, the problems you've outlined above do seem a little nitpicky (I guess I can understand wanting to add something to the top of the config file, but there's always the Don't get me wrong, your workflow's your workflow and if something's stopping you from having it work how you want it to, feel free to change things. I'm just wondering whether it might be easier to change your workflow slightly and save yourself the effort of porting this project to another .ini parser |
Platform
Operating system and version: Arch Linux
Legendary version: 0.20.34
Expected Behavior
Comments in
~/.config/legendary/config.ini
should be completely ignored.Current Behavior
Comments in
~/.config/legendary/config.ini
are treated as options.Steps to Reproduce
~/.config/legendary/config.ini
:legendary list-installed
:I'm also not allowed to add a comment at the top of the config file, i.e.:
The text was updated successfully, but these errors were encountered: