Problem with OpenSlide Python

Benjamin Gilbert bgilbert at cs.cmu.edu
Tue Nov 7 15:14:03 EST 2017


On Mon, Nov 06, 2017 at 12:08:04PM +0000, Francesco Daneluzzi wrote:
>   File "C:\Users\Francesco\Anaconda3\envs\py35\lib\site-packages\openslide\lowlevel.py", line 260, in read_region
>     buf = (w * h * float(c_uint32))()
> TypeError: float() argument must be a string or a number, not '_ctypes.PyCSimpleType'
> 
> The fact is that, in the last row, w and h are float (I printed them for
> debugging), but c_uint32 is not and I am getting that error.  What should
> I do about it?

Hi Francesco,

Are you using a modified version of OpenSlide Python?  Upstream OpenSlide
Python 1.1.1 doesn't have that float conversion:

    https://github.com/openslide/openslide-python/blob/v1.1.1/openslide/lowlevel.py#L258

Note that w and h must be int, not float.

--Benjamin Gilbert


More information about the openslide-users mailing list