python / cpython

The Python programming language
https://www.python.org
Other
63.39k stars 30.36k forks source link

ConfigParser module blames on section less ini file #67899

Closed 51d64aea-d370-4f31-8ed3-205977a1b46f closed 9 years ago

51d64aea-d370-4f31-8ed3-205977a1b46f commented 9 years ago
BPO 23711
Nosy @ambv, @vadmium
Superseder
  • bpo-22253: ConfigParser does not handle files without sections
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = None closed_at = created_at = labels = ['type-bug', 'library'] title = 'ConfigParser module blames on section less ini file' updated_at = user = 'https://bugs.python.org/MaximKot' ``` bugs.python.org fields: ```python activity = actor = 'martin.panter' assignee = 'none' closed = True closed_date = closer = 'martin.panter' components = ['Library (Lib)'] creation = creator = 'Maxim Kot' dependencies = [] files = [] hgrepos = [] issue_num = 23711 keywords = [] message_count = 2.0 messages = ['238537', '238587'] nosy_count = 3.0 nosy_names = ['lukasz.langa', 'martin.panter', 'Maxim Kot'] pr_nums = [] priority = 'normal' resolution = 'duplicate' stage = None status = 'closed' superseder = '22253' type = 'behavior' url = 'https://bugs.python.org/issue23711' versions = ['Python 2.7'] ```

    51d64aea-d370-4f31-8ed3-205977a1b46f commented 9 years ago

    Wikipedia (http://en.wikipedia.org/wiki/INI_file#Sections) says:

    Keys may (but need not) be grouped into arbitrarily named sections

    But when it's trying to parse file without section header - "MissingSectionHeaderError: File contains no section headers" raised.

    Can such check be made optional and switched on for default for example?

    vadmium commented 9 years ago

    I think this is already discussed in bpo-22253.