CellProfiler / python-bioformats

Read and write life sciences file formats
Other
131 stars 45 forks source link

Encode both 'str' and 'unicode' #79

Closed BioGeek closed 7 years ago

BioGeek commented 7 years ago

This avoids unicode errors when parsing metadata with Python 2.7. See also issue #55 and this stackoverflow question: http://stackoverflow.com/questions/43598709/bioformats-python-error-ascii-codec-cant-encode-character-u-xb5-when-using/43630921#43630921

mcquin commented 7 years ago

@BioGeek This appears to have introduced failures for Python 3.5. Is there a Python 2/3 compatible solution?

Traceback (most recent call last):

  File "/home/travis/build/CellProfiler/python-bioformats/bioformats/tests/test_formatwriter.py", line 44, in test_01_01_write_monochrome_8_bit_tif

    W.write_image(path, img, OME.PT_UINT8)

  File "/home/travis/build/CellProfiler/python-bioformats/bioformats/formatwriter.py", line 73, in write_image

    omexml = ome.OMEXML()

  File "/home/travis/build/CellProfiler/python-bioformats/bioformats/omexml.py", line 318, in __init__

    if isinstance(xml, basestring):

NameError: name 'basestring' is not defined
mcquin commented 7 years ago

Resolved #58