Skip to main content

Hi,

 

I have a sample R script. While the output is correct, FME is logging incorrect information.

 

The Code:

 

library(sf)


shp_path <- Output$shapefile_path


if (is.null(shp_path) || shp_path == "") {
  stop("location empty or no exists.")
}


shp_path <- normalizePath(shp_path, winslash = "/")


if (!file.exists(shp_path)) {
  stop("location not found: ", shp_path)
}


print(paste("read shapefile:", shp_path))

shape_data <- st_read(shp_path)


if (is.null(shape_data)) {
  stop("Error in shapefile:", shp_path)
}


shape_data$ano <- 2025


output_path <- shp_path
print(paste("Writing:", output_path))

st_write(shape_data, output_path, delete_layer = TRUE)

print("Success.")

 

Log below:

 

Error in utils::read.table(value, sep = sep, header = header, skip = skip,  : 
  no lines available in input
Calls: dbWriteTable -> dbWriteTable -> .local -> <Anonymous>
In addition: Warning message:
In file(file, "rt") :
  file("") only supports open = "w+" and open = "w+b": using the former
Execution halted
Failed to execute scripted code
 

 

Thank´s

Hi, @mr_fme

Thanks for posting your question! Looking at the error and warning messages here, along with the code, before troubleshooting further, when you stated “While the output is correct, FME is logging incorrect information.” could you clarify what you mean?

Thanks!


Hi @AliAtSafe 

 

Thank you for your message.

This script only creates a single column in the shapefile. After the execution, the shapefile is modified, but the log still shows this information.


Hi, @mr_fme.

Thanks for your input! Interesting. Which version of FME are you using? Are all R packages installed and necessary modules imported in FME? Any data type mismatches that may be used in your code?

Thanks!


@AliAtSafe,

My version is 2024.0. All R packages are installed and modules was imported in FME.

 

There is no type mismatches. The script run properly in RStudio, without error or warning messages in the log.


Hello, @mr_fme.

Sorry for the late reply. If you can, could you kindly provide your workspace and log file? Going to take a look to see if there is a potential issue or a bug.

Thanks!


Reply