[GRASS-user] v.class.mlR Error

Helmut Kudrnovsky hellik at web.de
Thu May 31 03:21:18 PDT 2018


Helmut Kudrnovsky wrote
>>In file(file, ifelse(append, "a", "w")) :
>> cannot open file '.gscript_tmp_model_output_2392.csv': Permission denied 
> 
> in the R script:
> 
> [...]
> resultsdf$prob_smv <- vote$V2
> write.csv(resultsdf, '.gscript_tmp_model_output_2392.csv',
> row.names=FALSE,
> quote=FALSE)
> write.csv(resultsdf, 'D:\temp\vclassr\class.txt', row.names=FALSE,
> quote=FALSE)
> [...]
> 
> AFAIR in windows and python, you need to specify the temp file e.g. by
> python's tempfile functions that it can be found later in the process.

as an example I do it in 

https://trac.osgeo.org/grass/browser/grass-addons/grass7/raster/r.euro.ecosystem/r.euro.ecosystem.py#L72

72	    # define intermediate folder files
73	    datatempdir = tempfile.gettempdir()
74	    if level1 :
75	        tmp_col_l1 = os.path.join( datatempdir, color_rules_level1 )
76	        tmp_cat_l1 = os.path.join( datatempdir, cat_rules_level1 )
77	    if level2 :   
78	        tmp_col_l2 = os.path.join( datatempdir, color_rules_level2 )
79	        tmp_cat_l2 = os.path.join( datatempdir, cat_rules_level2 )  

maybe there are nicer and more pythonic ways to do it ;-)




-----
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Users-f3884509.html


More information about the grass-user mailing list