From a8bf907a4ce82b8e6a48908936a3ec4edc845f7b Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 18 Jan 2020 06:46:56 -0600 Subject: Fix typeerror with adding values that aren't strings --- CHANGELOG.md | 9 +++++++++ config_file/parsers/ini_parser.py | 3 +++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b982077..2180eb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.3.3 + +Fixed + +- `TypeError` when setting the key/value pairs since configparser requires the option + to be a string. The parser now just converts the value to a string if it is not one + and then adds the key/value pair. It would still be parsed correctly when retrieving + it. + ## 0.3.2 - 2020-01-17 Changed diff --git a/config_file/parsers/ini_parser.py b/config_file/parsers/ini_parser.py index 4e0922c..3c8f12f 100644 --- a/config_file/parsers/ini_parser.py +++ b/config_file/parsers/ini_parser.py @@ -60,6 +60,9 @@ class IniParser(BaseParser): if value is not None and not self.parsed_content.has_section(section): self.parsed_content.add_section(section) + if not isinstance(value, str): + value = str(value) + self.parsed_content.set(section, key, value) return True -- cgit v1.2.3