Skip to main content
Question

RCaller with problems

  • October 22, 2024
  • 9 replies
  • 152 views

mr_fme
Enthusiast
Forum|alt.badge.img+8

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

9 replies

AliAtSafe
Safer
Forum|alt.badge.img+22
  • Safer
  • October 23, 2024

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!


mr_fme
Enthusiast
Forum|alt.badge.img+8
  • Author
  • Enthusiast
  • October 23, 2024

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.


AliAtSafe
Safer
Forum|alt.badge.img+22
  • Safer
  • October 24, 2024

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!


mr_fme
Enthusiast
Forum|alt.badge.img+8
  • Author
  • Enthusiast
  • October 24, 2024

@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.


AliAtSafe
Safer
Forum|alt.badge.img+22
  • Safer
  • October 31, 2024

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!


hazzular_2
Participant
Forum|alt.badge.img
  • Participant
  • January 15, 2025

Hi, I am having the exact same errors in the log. Rcaller completes the tasks correctly e.g writing an csv file to a folder, but the workspace has failed. Has there been any solution to this? 


mr_fme
Enthusiast
Forum|alt.badge.img+8
  • Author
  • Enthusiast
  • January 15, 2025

No solved yet...My workspace run correctly, but with erros. It´s bad!! Because can´t continue the workspace with others transformers.


hazzular_2
Participant
Forum|alt.badge.img
  • Participant
  • January 17, 2025

Hi ​@mr_fme , I think I’ve solved my issue, maybe it will work for you to. To stop my workspace from failing I have assigned a value to fmeOutput, for example I just added this to the end of my Rcaller:

f <- c(1,2,3,4,2)
fmeOutput<- data.frame(Mean = mean(f))


mr_fme
Enthusiast
Forum|alt.badge.img+8
  • Author
  • Enthusiast
  • January 17, 2025

I try. Thank´s


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings