1

I am trying to use to sen2r() function (Package sen2r_1.3.2) with default parameters but getting the following error:

Error in paste(c(...), collapse = sep) : argument is missing, with no default.

I know the error wants me to fill in some parameters, but the source manual clearly says that the default should work, and the parameters can be set subsequently upon launching the GUI.

Using the s2_gui() launches the shiny app, but keeps hanging when I try to "Save and Close"

   R version 3.6.3 (2020-02-29)
   Platform: x86_64-pc-linux-gnu (64-bit)
   Running under: Ubuntu 18.04.4 LTS

Also, can someone with a 'higher reputation' please create a sen2r tag, for easier subsequent communications?


Here is the traceback...

sen2r()
Error in paste(c(...), collapse = sep) : 
  argument is missing, with no default
> traceback()
7: paste(c(...), collapse = sep)
6: strsplit(paste(c(...), collapse = sep), "\n")
5: unlist(strsplit(paste(c(...), collapse = sep), "\n"))
4: strwrap(unlist(strsplit(paste(c(...), collapse = sep), "\n")), 
       width = width, indent = indent, exdent = exdent, prefix = prefix, 
       initial = initial)
3: print_message(type = "waiting", "It seems you are running this package for the first time. ", 
       "Do you want to verify/install the required dependencies using a GUI (otherwise, an\n        automatic check will be performed)? (y/n) ", 
       )
2: .sen2r(param_list = param_list, pm_arg_passed = pm_arg_passed, 
       gui = gui, preprocess = preprocess, s2_levels = s2_levels, 
       sel_sensor = sel_sensor, online = online, order_lta = order_lta, 
       apihub = apihub, downloader = downloader, overwrite_safe = overwrite_safe, 
       rm_safe = rm_safe, step_atmcorr = step_atmcorr, sen2cor_use_dem = sen2cor_use_dem, 
       sen2cor_gipp = sen2cor_gipp, max_cloud_safe = max_cloud_safe, 
       timewindow = timewindow, timeperiod = timeperiod, extent = extent, 
       extent_name = extent_name, s2tiles_selected = s2tiles_selected, 
       s2orbits_selected = s2orbits_selected, list_prods = list_prods, 
       list_rgb = list_rgb, list_indices = list_indices, index_source = index_source, 
       rgb_ranges = rgb_ranges, mask_type = mask_type, max_mask = max_mask, 
       mask_smooth = mask_smooth, mask_buffer = mask_buffer, clip_on_extent = clip_on_extent, 
       extent_as_mask = extent_as_mask, reference_path = reference_path, 
       res = res, res_s2 = res_s2, unit = unit, proj = proj, resampling = resampling, 
       resampling_scl = resampling_scl, outformat = outformat, rgb_outformat = rgb_outformat, 
       index_datatype = index_datatype, compression = compression, 
       rgb_compression = rgb_compression, overwrite = overwrite, 
       path_l1c = path_l1c, path_l2a = path_l2a, path_tiles = path_tiles, 
       path_merged = path_merged, path_out = path_out, path_rgb = path_rgb, 
       path_indices = path_indices, path_subdirs = path_subdirs, 
       thumbnails = thumbnails, parallel = parallel, processing_order = processing_order, 
       use_python = use_python, tmpdir = tmpdir, rmtmp = rmtmp, 
       log = log, globenv = sen2r_env, .only_list_names = FALSE)
1: sen2r()

I ran s2_gui() as is...no parameters specified. But i am running the dependency check now, I suspect that should clear things up even for the GUI.

Roman Luštrik
  • 69,533
  • 24
  • 154
  • 197
Mansi
  • 133
  • 2
  • 11
  • 1
    I think you'll need to give more than this. The only place in the code that has `paste(c(...), collapse=sep)` is in [`print_message.R#L69`](https://github.com/ranghetti/sen2r/blob/668d351d98f3e841da5df1415b2dd4c60fd604ce/R/print_message.R#L69); and that function `print_message` is called at least 293 times in the package ... knowing which time would be useful. Can you include the output from `traceback()` immediately after the error? Also, how are you calling it, just as `s2_gui()` or some other way? What inputs are you providing/changing? – r2evans Mar 22 '20 at 04:56

2 Answers2

2

This error was due to a code bug, which was fixed (see the GitHub issue 292).

Until the sen2r CRAN version will be updated, the bug can be:

  1. solved installling the sen2r GitHub version (remotes::install_github("ranghetti/sen2r")), or
  2. bypassed launching check_gdal() before running sen2r().
1

This is a bug in the original code.

In the traceback that you provided, it included:

3: print_message(type = "waiting", "It seems you are running this package for the first time. ", 
       "Do you want to verify/install the required dependencies using a GUI (otherwise, an\n        automatic check will be performed)? (y/n) ", 
       )

Notably, I'll truncate most of the strings:

3: print_message(type = "waiting", "It seems ... time. ", 
       "Do you ... performed)? (y/n) ",  
       )                         #    ^-- extra comma, invalid R syntax

Notice how it ends with a comma and then a right-paren? Yup, that's a syntax error in R. (This has been submitted as issue 292 on the original repo.)

r2evans
  • 141,215
  • 6
  • 77
  • 149
  • Thanks.... The s2_gui() works now though, with install_sen2cor() – Mansi Mar 22 '20 at 06:08
  • Mansi, I suggest you "accept" Luigi's answer: it provides two workarounds (until CRAN is updated) and is more of a solution than my answer here that just isolates/identifies the bug. – r2evans Mar 22 '20 at 16:11