DiffSK/configobj

Any string with a '#' gets parsed incorrectly from the config file

Closed this issue · 6 comments

Any string with a '#' gets parsed incorrectly from the config file. For example the string 'some#string' would only be parsed as 'some'. I suspect this because of the way this is passed to the python interpreter?

I am currently running version 5.0.6 on python 3.6.

Please provide a short example .conf file.

You can mark this resolved, if you wrap it in single quotes it will work.

EXAMPLE = '#example#example'

From a member of my irc group.
You could fix this regex error.

https://github.com/DiffSK/configobj/blob/master/src/configobj/__init__.py#L1101 and used here https://github.com/DiffSK/configobj/blob/master/src/configobj/__init__.py#L1830, mat.groups() a few lines later will have the comment

The issue here appears to be that configobj considers everything in your value after the "#" to be an inline comment.
I think your best option is to quote your value as @jhermann recommended.
Alternatively, if you don't use inline comments, then rather than changing the regex which could lead to unexpected behavior for people who rely on inline comments, I think you should ask for a feature that disables support inline comments.

resolving based on the enclosing quotes working as expected