I am tryng to edit a Splunk config file that has a section with no name
Conf file
# Application-level permissions
[]
access = read : [ * ], write : [ admin, power ]
Code
>>> import configparser
>>> config = configparser.RawConfigParser()
>>> config.read('sh-apps-pro/indexed_volume/metadata/default.meta')
Traceback (most recent call last):
File "<input>", line 1, in <module>
config.read('sh-apps/pro/indexed_volume/metadata/default.meta')
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/backports/configparser/
__init__.py", line 705, in read
self._read(fp, filename)
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/backports/configparser/
__init__.py", line 1101, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
MissingSectionHeaderError: File contains no section headers.
file: 'sh-apps-pro/indexed_volume/metadata/default.meta', line: 4
u'[]\n'
I tried to set the default_section as an empty string with
config = configparser.RawConfigParser(default_section='')
But it looks like is not considered a valid name because it launches the same exception