BUGFIX: Prevent corrupting all files when no UUID is yet stored in a file
This commit is contained in:
parent
514ed1aa32
commit
695a05b262
@ -986,7 +986,13 @@ class Measurement:
|
|||||||
"""
|
"""
|
||||||
# See if the base part of the filename is referring to a file that is already open
|
# See if the base part of the filename is referring to a file that is already open
|
||||||
with h5.File(fn, 'r') as f:
|
with h5.File(fn, 'r') as f:
|
||||||
|
try:
|
||||||
uuid = f.attrs['UUID']
|
uuid = f.attrs['UUID']
|
||||||
|
except AttributeError:
|
||||||
|
# No UUID stored in measurement. This is an old measurement that did not have UUID's
|
||||||
|
# We create a new UUID here such that the file is opened from the filesystem
|
||||||
|
# anyhow.
|
||||||
|
uuid = str(uuid.uuid1())
|
||||||
|
|
||||||
if uuid in Measurement.uuid_s.keys():
|
if uuid in Measurement.uuid_s.keys():
|
||||||
return Measurement.uuid_s[uuid]
|
return Measurement.uuid_s[uuid]
|
||||||
|
Loading…
Reference in New Issue
Block a user