'configparser.ParsingError: Source contains parsing errors: 'my.ini'
I am getting this error: configparser.ParsingError: Source contains parsing errors: 'my.ini'
although I am getting uncommented-values printed on the terminal.
my.ini
:
[my]
# user
root
# passwd
password
I read here that #
or ;
could be used for commenting. This is how I am doing it:
import configparser
c = configparser.ConfigParser()
c.read('my.ini')
getval = c.items('my')
Solution 1:[1]
I am facing the same issue, but the below line resolves the error the as same above one.
from configparser import ConfigParser
config = ConfigParser(allow_no_value=True)
Thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mantu |