Opened 9 years ago

Closed 8 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 by neteler, 9 years ago

Milestone: 7.0.3

Ticket retargeted after milestone closed

comment:2 by neteler, 9 years ago

Milestone: 7.0.4

Ticket retargeted after 7.0.3 milestone closed

in reply to:  description ; comment:3 by glynn, 9 years ago

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.

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

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.

in reply to:  4 comment:5 by martinl, 9 years ago

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 by neteler, 9 years ago

Milestone: 7.1.07.2.0

Milestone renamed

comment:7 by annakrat, 8 years ago

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