Opened 4 years ago

Closed 3 years ago

#2879 closed defect (fixed)

grass.script.array cannot read raster on Windows

Reported by: annakrat Owned by: grass-dev@…
Priority: critical Milestone: 7.2.0
Component: Python Version: svn-trunk
Keywords: wingrass, numpy Cc:
CPU: Unspecified Platform: MSWindows 8

Description

When testing the example from documentation here

map2d_2.read("map2d_1")

doesn't work and fails because r.out.bin can't write into the temporary file. This file is created when the array is initialized and it is open, so on Windows no other process can write to it.

Change History (7)

comment:1 Changed 4 years ago by neteler

Milestone: 7.0.3

Ticket retargeted after milestone closed

comment:2 Changed 4 years ago by neteler

Milestone: 7.0.4

Ticket retargeted after 7.0.3 milestone closed

comment:3 in reply to:  description ; Changed 4 years ago by glynn

This file is created when the array is initialized and it is open, so on Windows no other process can write to it.

It's possible for multiple processes to write to the same file, but that may require specifying additional flags (which neither the underlying numpy.memmap constructor nor Python's mmap.mmap constructor appear to support). OTOH, it's also possible that Windows doesn't allow writing to files which are memory-mapped.

It isn't possible to avoid opening the file in the constructor, so the only other option would be to optionally pass the mapname and null parameters to the constructor and have the constructor call the read() method before calling the parent constructor.

comment:4 in reply to:  3 ; Changed 4 years ago by annakrat

Milestone: 7.0.47.1.0

Replying to glynn:

It isn't possible to avoid opening the file in the constructor, so the only other option would be to optionally pass the mapname and null parameters to the constructor and have the constructor call the read() method before calling the parent constructor.

I implemented this in r67710 some time ago and tested on Linux and Windows. I don't think we should backport it, since it changes the API. If people agree, I would close this as solved.

comment:5 in reply to:  4 Changed 4 years ago by martinl

Replying to annakrat:

I implemented this in r67710 some time ago and tested on Linux and Windows. I don't think we should backport it, since it changes the API. If people agree, I would close this as solved.

+1 for closing

comment:6 Changed 3 years ago by neteler

Milestone: 7.1.07.2.0

Milestone renamed

comment:7 Changed 3 years ago by annakrat

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.