Re: NameError: name 'Window' is not defined

Sean Gillies

Hi Quin,

The Window class is defined in the module and you must explicitly import it into your program's code like this:

    from import Window

Example code in our docs might obscure this need, if you see any docs that don't show import of the Window class, let me know and I'll fix them.

On Mon, May 6, 2019 at 1:23 PM <quinsen.joel@...> wrote:
Hello. I'm new to this forum, so let me know if there are any problems with my question here.

I am trying to use rasterio's windowed reading ability and I am hoping to use the following structure as shown on rasterios documentation page (
with'file.tif') as src:
   window =, window=Window(0, 0, new_height, new_width)) 
However, when I try to do this I get:
```NameError: name 'Window' is not defined```
Shouldn't Window() be imported with rasterio? Is this a problem with the version of rasterio I have downloaded or am I missing something really easy here?
print (rasterio.__version__)
Thank you for your guidance,

Sean Gillies

Join to automatically receive all group messages.