On Thu, Feb 1, 2018 at 12:04 PM, Helmut Kudrnovsky <hel...@web.de> wrote:

> Dinarzarde Raheem wrote
> > I have been trying to run the addon r.vif using Grass for MS Windows
> > standalone v. 7.2.2 and v. 7.0.5 on three separate PCs (two have Windows
> 7
> > 32bit/64 bit, one runs Windows 10 Home 64 bit). I have been testing the
> > r.vif installation using the example on the r.vif page of the Grass 7
> > addons manual (i.e. this uses  the GRASS 7 Climatic data time series NC
> > location nc_climate_spm_2000_2012).
> >
> > With v. 7.2.2 (in both Windows 7 and 10) I can load the extension, and
> can
> > visualise Addons in the search modules tab, but the r.vif. tool is not
> > visible under Addons.
> >
> > With v. 7.0.5  (in both Windows 7 and 10), I can load r. vif, visualise
> it
> > under Addons in  the Search Modules tab and run it, but I get the
> > following error message:
> >
> >
> > (Wed Jan 31 15:06:21 2018)
> >
> > r.vif
> > maps=2011_01_precip@climate_1970_2012,2011_02_precip@climate
> _1970_2012,2011_03_precip@climate_1970_2012,2011_04_
> precip@climate_1970_2012,2011_05_precip@climate_1970_2012,
> 2011_06_precip@climate_1970_2012,2011_07_precip@climate_
> 1970_2012,2011_08_precip@climate_1970_2012,2011_09_
> precip@climate_1970_2012,2011_10_precip@climate_1970_2012,
> 2011_11_precip@climate_1970_2012,2011_12_precip@climate_1970_2012
> > maxvif=10 file=C:\grassworkspace\2011test
> >
> > Reading in the data ...
> >
> > Traceback (most recent call last):
> >
> >   File "C:\Users\dinr\AppData\Roaming\GRASS7\addons/scripts/
> >
> > r.vif.py", line 365, in
> > <module>
> >     sys.exit(main(*gs.parser()))
> >
> >   File "C:\Users\dinr\AppData\Roaming\GRASS7\addons/scripts/
> >
> > r.vif.py", line 226, in main
> >
> >     p = ReadData(IPF, n)
> >
> >   File "C:\Users\dinr\AppData\Roaming\GRASS7\addons/scripts/
> >
> > r.vif.py", line 156, in ReadData
> >
> >     os.remove(tmpcov)
> >
> > WindowsError: [Error 32] The process cannot access the file
> >
> > because it is being used by another process:
> >
> > 'c:\\users\\dinr\\appdata\\local\\temp\\tmpsggohd'
> >
> > (Wed Jan 31 15:06:25 2018) Command finished (4 sec)
> >
> > Is there anything I can do to fix this issue?
>
> the reason for the error are these lines of code in the r.vif script:
>
> <-------------
>     [...]
> 155    # Clean up
> 156    os.remove(tmpcov)
> -------------->
>
> the temporary file tmpcov isn't closed, therefore the temporary file can't
> be deleted.
>
> just for testing I changed locally here in the script
>
> <-------------
>     [...]
> 155    # Clean up
> 156    # os.remove(tmpcov)
> -------------->
>
> now the script finishes with results.
>
> the reason is that handling of temporary files in python is different in
> linux and windows.
>
> ping the script author (mentioned in [1]) and ask him to adapt the script
> that it's also working in windows.
>
>
>
> [1] https://grass.osgeo.org/grass74/manuals/addons/r.vif.html
>
>
>
> Hi Dinarzard, I will have a look at it. Helmut, I see you commented out
the line that removes the temporary file. Any idea how I can do that in
such a way that it works on both Linux and Windows?


>
> -----
> best regards
> Helmut
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Users-f3884509.html
> _______________________________________________
> grass-user mailing list
> grass-user@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to