Skip to content

configparser throws ParsingError when reading ini file #134516

@PhilippKosarev

Description

@PhilippKosarev

Bug report

Bug description:

Code snippet:

parser = configparser.ConfigParser()
ini_file = '/home/philipp/.local/share/Steam/steamapps/compatdata/244210/pfx/drive_c/users/steamuser/Documents/Assetto Corsa/cfg/extension/state/lua/app/CspDebug.ini'
parser.read(ini_file)

Error:

File "/mnt/sda1/Programming/accm/libjam/notebook.py", line 58, in read_ini
    parser.read(ini_file)
    ~~~~~~~~~~~^^^^^^^^^^
  File "/usr/lib64/python3.13/configparser.py", line 735, in read
    self._read(fp, filename)
    ~~~~~~~~~~^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/configparser.py", line 1050, in _read
    ParsingError._raise_all(self._read_inner(fp, fpname))
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/configparser.py", line 334, in _raise_all
    raise next(exceptions).combine(exceptions)
configparser.ParsingError: Source contains parsing errors: '/home/philipp/.local/share/Steam/steamapps/compatdata/244210/pfx/drive_c/users/steamuser/Documents/Assetto Corsa/cfg/extension/state/lua/app/CspDebug.ini'
	[line  9]: "}'\n"

Contents of ini_file:

[STRING]
12866846752895976527='{
  distance = 100,
  count = 10,
  dirty = false,
  flags = { bsphere = false, bbox = true, outline = true, text = true },
  filter = "?",
  active = false
}'

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directory

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions