From 36b027b290d432e1a02569dbfb4639bada22f19e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 9 Aug 2016 15:25:17 +0200 Subject: [PATCH] Fix copying ConfigParser Turns out that copy.copy() doesn't work on ConfigParsers. It returns a different instance but modifying that instance still modifies the old configs. Deep copy isn't allowed. But this dictionary copy works. Contributes to issue CURA-844. --- plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py b/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py index 158f7fa2a6..75e0f158e5 100644 --- a/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py +++ b/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py @@ -2,7 +2,6 @@ # Cura is released under the terms of the AGPLv3 or higher. import configparser #To read config files. -import copy #To split config files into multiple config files. import io #To write config files to strings as if they were files. import UM.VersionUpgrade @@ -146,7 +145,8 @@ class Profile: #Split this profile into multiple profiles, one for each material. for material_id in _new_materials: filenames.append("{profile}_{material}".format(profile = self._filename, material = material_id)) - config_copy = copy.copy(config) + config_copy = configparser.ConfigParser(interpolation = None) + config_copy.read_dict(config) #Copy the config to a new ConfigParser instance. config_copy.set("metadata", "material", material_id) configs.append(config_copy) else: