Closed suever closed 9 years ago
From darcymason@gmail.com on September 26, 2009 16:41:15
Thanks, Pierre. Excellent suggestion. I checked that basestring is available since python 2.3 so it is available for all python versions pydicom supports. Will make this change.
Status: Accepted
Owner: darcymason
Labels: -Difficulty-Medium Difficulty-Easy
From pierre.raybaut on September 25, 2009 07:56:11
Hi,
To avoid this error when trying to pass a unicode path to dicom.ReadFile:
Traceback (most recent call last): File "***_.py", line __, in _****
File "C:\Python26\lib\site-packages\dicom\filereader.py", line 416, in read_file fp.defer_size = defer_size AttributeError: 'unicode' object has no attribute 'defer_size'
I suggest replacing line 409 in dicom/filereader.py, function "read_file":
original code: (does not handle the unicode case) if type(fp) is type(""):
suggested replacement code: (handle any type of string, including unicode) if isinstance(fp, basestring):
Keep up the good work, Cheers, Pierre
Original issue: http://code.google.com/p/pydicom/issues/detail?id=58