[GRASS-dev] GRASS Python Ctypes: Write Raster produces No null file error!!

Glynn Clements glynn at gclements.plus.com
Mon Apr 11 17:36:37 EDT 2011


Sudipta Sarkar wrote:

> Please help me solve the following, I am entirely new to the whole
> Python-GRASS-Ctypes issue so please bear with me. 
> 
> I am trying to develop an application using Python Ctypes hooks to GRASS
> C libraries. Have done most of the part but getting stuck in the end
> where i try to write off my output file as GRASS raster. I am giving the
> relevant part below along with the error I am getting:

> When it comes to executing the line "Rast_close(out_fd)" I am getting
> the error: "ERROR: No null file for <madresult.0>"

The problem occurs because the script writes fewer rows to the file
than it should. The raster library attempts to deal with this by
padding the file with zeros, but there's a bug in the code (it has
already closed the null file at the point where it tries to write the
additional rows; that's what the error message is reporting).

Even if we fix the bug in the raster library, the fact that you aren't
writing the correct number of rows suggests that there's a bug in the
script.

If you're reading or writing rasters using a modified window (region),
note that the window handling has changed significantly between 6.x
and 7.0 (in particular, 7.0 has separate windows for input and
output).

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list