Hello,
I want to change some data in a few dicom files and I do it like this:
dataSet = dicom.read_file(fileName)
...
dataSet[tag].value = aValue
...
dicom.write_file(fileName, dataSet)
When reaching the final statement, I get an error:
2009-12-03 15:00:07 ScriptError: (0) Traceback (most recent call
last):
2009-12-03 15:00:23 ScriptError: MyTool.py(340) error, see below
2009-12-03 15:00:24 ScriptError: MyTool.py(340) dicom.write_file
(fileName, dataSet)
2009-12-03 15:00:24 ScriptError: filewriter.py(248) error, see below
2009-12-03 15:00:24 ScriptError: filewriter.py(248) fp = DicomFile
(filename,'wb')
2009-12-03 15:00:24 ScriptError: filebase.py(152) error, see below
2009-12-03 15:00:24 ScriptError: filebase.py(152) return
DicomFileLike(open(*args, **kwargs))
2009-12-03 15:00:24 ScriptError: filebase.py(152) IOError: [Errno 13]
Permission denied: u'D:/Data/aFile.dcm'
If I use ProcessExplorer (
http://technet.microsoft.com/en-us/
sysinternals/bb896653.aspx) to search for file handles I can see that
'aFile.dcm' is still open (!).
I checked and apparently the file should get closed towards the end of
the "dicom.read_file()" method (though not through the original
handle).
Is there a bug in "dicom.read_file()" or am I missing something?
Andrei