bgilbert / anonymize-slide

Delete the label from a whole-slide image
GNU General Public License v2.0
58 stars 45 forks source link

Update for Python 3 #4

Open PeterStrom opened 4 years ago

PeterStrom commented 4 years ago

Whould be very nice with an update for Python 3.

r3m0chop commented 4 years ago

A quick 2to3 only indicates trivial changes. Hoping to test these shortly.

r3m0chop commented 4 years ago

The Python 2 inheritance of TiffFile from the file class, however, is another issue, as at: https://github.com/bgilbert/anonymize-slide/blob/master/anonymize-slide.py#L70: class TiffFile(file):

Possible clues on approaching this might be found at: https://stackoverflow.com/questions/16085292/subclassing-file-objects-to-extend-open-and-close-operations-in-python-3

... most-specifically, see the following answer, with a similar requirement of supporting both Python 2.x and 3.x.: https://stackoverflow.com/questions/16085292/subclassing-file-objects-to-extend-open-and-close-operations-in-python-3/16085830#16085830

Discussion around a different answer to the above (starting with "tl;dr Use a context manager", and using io.TextIOWrapper), at: https://stackoverflow.com/questions/16085292/subclassing-file-objects-to-extend-open-and-close-operations-in-python-3/23796737#23796737 spawned a newly related question that might also be useful, at: : https://stackoverflow.com/questions/33155741/subclassing-file-by-subclassing-io-textiowrapper-but-what-signature-does-its )

r3m0chop commented 4 years ago

Pull Request created (with only Python 3 support, since Python 2 now beyond life) at: PR https://github.com/bgilbert/anonymize-slide/pull/5

jetic83 commented 4 years ago

+1

a-dev-walker commented 4 years ago

+1

markemus commented 4 years ago

@r3m0chop I added a pull request with an update for Python 3 a while back.

kimalaacer commented 4 years ago

I am trying this code on python 3. getting this error. I tested the svs file and it opens with imagescope still getting the error even if i use the absolute path.

C:\New folder>anonymize-slide.py test1.svs Usage: anonymize-slide.py [options] file [file...]

anonymize-slide.py: error: specify a file