openslide/openslide-python

ValueError: Argument is not writable

tnnandi opened this issue · 4 comments

Operating system

Ubuntu

Platform

64 bit x86

OpenSlide Python version

1.3.1

OpenSlide version

4.0.0

Slide format

SVS

Issue details

Hi,

When I try to use the read_region function as follows:
level = slide.get_best_level_for_downsample(32)
region = slide.read_region((0, 0), level, slide.level_dimensions[level])

I get the following error:
region = slide.read_region((0, 0), level, slide.level_dimensions[level])
*** ValueError: Argument is not writable

I'd appreciate it if you could suggest a solution.

Thanks

I can't reproduce this behavior:

$ cat test.py 
import openslide
slide = openslide.OpenSlide('Aperio/CMU-1.svs')
level = slide.get_best_level_for_downsample(32)
region = slide.read_region((0, 0), level, slide.level_dimensions[level])
print(region)
$ python test.py 
<PIL.Image.Image image mode=RGBA size=2875x2057 at 0x7EFFF1440E00>

Can you provide any more details that would help reproduce it?

Thanks for your input! I think the issue was tied to the pillow version. With Pillow 10.1.0, I was encountering another issue related to the ANTIALIAS attribute of PIL.image, and I had to downgrade the Pillow version to 9.5.0 to get around both.

Hmm, okay. I've now tried with both Pillow 9.5.0 and 10.1.0 and still cannot reproduce this. Can you provide any more information, such as a full backtrace for the ValueError? How did you install OpenSlide and OpenSlide Python?