From: W. Trevor King Date: Tue, 19 Apr 2011 23:06:28 +0000 (-0400) Subject: Better solution to overwriting preexisting datasets. X-Git-Tag: 0.5~9 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=28a80176ba53c1dc55f7ad5120f0fbe5ceae18e5;p=pypiezo.git Better solution to overwriting preexisting datasets. Remove them and start from scratch. The previous implementation did things like >>> dataset = 'no' >>> dataset[...] = 'yes' >>> dataset[...] 'ye' --- diff --git a/pypiezo/config.py b/pypiezo/config.py index 878027b..1d67a18 100644 --- a/pypiezo/config.py +++ b/pypiezo/config.py @@ -576,12 +576,12 @@ class _HDF5Config (_BackedConfig): else: f = None for s in self.settings: + value = s.convert_to_text(self[s.name]) try: - dataset = group[s.name] + del group[s.name] except KeyError: - group[s.name] = s.convert_to_text(self[s.name]) - else: - group[s.name][...] = s.convert_to_text(self[s.name]) + pass + group[s.name] = value if f: f.close()