kevinwolz / hisafer

An R toolbox for the Hi-sAFe biophysical agroforestry model
6 stars 4 forks source link

[solved]: error "Result 1 must be a single string, not NULL of length 0" #154

Open mariegosme opened 2 years ago

mariegosme commented 2 years ago

It happens often to get the uninformative error "Result 1 must be a single string, not NULL of length 0" (e.g. in issue #129 for build_hisafe, it happened also in define_hisafe and in read_hisafe when using user-defined templates with files that were modified "by hand"). This error is thrown by the function read_param_file when reading a user-modified file (.plt, .tree, .tec, .sim...) that contains "mistakes". Frequent mistakes are:

mariegosme commented 2 years ago

A solution for the first case (line containing characters that cannot be interpreted as either a block title, nor a parameter value) could be to check that line.text contains "=" before line 87 in params.R (element.vals <- purrr::map_chr(strsplit(line.text, split = "=", fixed = TRUE), 2) )