Closed suever closed 9 years ago
From NikitaTh...@gmail.com on January 28, 2010 09:36:20
In the second sentence of my bug report, "latter" should say "former".
From darcymason@gmail.com on January 30, 2010 09:44:15
At some point pydicom transitioned to using a DicomFileLike object, and passing a true file or StringIO to read_file() no longer worked (a bug, as pointed out here). However, the very recent repository pushes have fundamentally reworked that process again, going back to simple files (for reading, not writing yet), and include code very similar to this patch. So I believe this bug has been fixed. I've written some unit tests to be sure, and expect to push them to the repository soon. -Darcy
Status: Started
From darcymason@gmail.com on January 30, 2010 13:42:23
This issue was closed by revision aec1410aad .
Status: Fixed
Mergedinto: -
From NikitaTh...@gmail.com on January 27, 2010 17:44:32
According to the docstring, read_file() accepts "either a file-like object, or a string containing the file name". However, only the latter works in practice. Both file and StringIO objects cause read_file() to fail. I attached a patch for the problem.
Here's an interpreter session that demonstrates the problem using the test file rtplan.dcm: $ python Python 2.5.1 ( r251 :54863, Nov 17 2007, 21:19:53) [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin Type "help", "copyright", "credits" or "license" for more information.
Applying the attached patch gets things working smoothly:
$ python Python 2.5.1 ( r251 :54863, Nov 17 2007, 21:19:53) [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin Type "help", "copyright", "credits" or "license" for more information.
Hope this helps, Philip
Attachment: filereader.patch
Original issue: http://code.google.com/p/pydicom/issues/detail?id=73