Issues with put_object function
12:39 05 Jan 2026

I am trying to save a csv File in my COS using a R notebook, but this solution, that worked well for me in another project, now is giving me issues. Here is the code I run:

csv_lines <- capture.output(write.csv(salv_final, row.names=FALSE), type="output")
csv_raw <- charToRaw(paste0(csv_lines, collapse='\n'))
project$save_data(glue("HP_GP.csv"), csv_raw, overwrite = TRUE)

put_object(file= csv_raw,
    object ="/folder/HP_GP.csv",
    bucket = "mybucket",
    folder ="/folder",
    key= "key",
    secret = "secret",
    check_region = FALSE,
    region = "",
    base_url = "url")

and here is the error

Error in file.info(..., extra_cols = FALSE): invalid filename argument
Traceback:

1. file.size(file)
2. file.info(..., extra_cols = FALSE)
3. .handleSimpleError(function (cnd) 
 . {
 .     watcher$capture_plot_and_output()
 .     cnd <- sanitize_call(cnd)
 .     watcher$push(cnd)
 .     switch(on_error, continue = invokeRestart("eval_continue"), 
 .         stop = invokeRestart("eval_stop"), error = NULL)
 . }, "invalid filename argument", base::quote(file.info(..., extra_cols = FALSE)))

can anybody solve this? Thanks!

r ibm-cloud