Open GoogleCodeExporter opened 9 years ago
Thanks for the issue and sample file. However, on python 2.7, I don't see this
error after running the steps to generate the problem. In regular python, val
should never be unicode. A quick search shows that (at least some time ago)
IronPython did everything in unicode, so the error is probably unique to
IronPython.
Hmmm... so what to do... I'm not convinced this is the only place where unicode
would cause a problem. Even in the python 3 version of pydicom, I expect val
will come into MultiString as bytes (but probably will be converted inside).
I'll think about this. Meanwhile, the code fix above may not be quite right --
it doesn't check valtype before dealing with the unicode. As noted in the
comments, valtype could be something like UID. Is it str(val) that is causing
the problem when val is unicode? If so, then a solution that should work would
be just to change valtype from str if necessary. This check after the trailing
blank part should work:
if isinstance(val, unicode) and valtype == str:
valtype = unicode # or even a null function that does nothing should work
That would also work with the new list comprehension line for python >2.4.
Original comment by darcymason@gmail.com
on 24 Apr 2012 at 12:56
Original issue reported on code.google.com by
j...@computer.org
on 23 Apr 2012 at 4:02Attachments: