Source() printing environment in saved scripts

Anyone else annoyed by this? I guess the predict.R script which sources methods from our local env and saves them to text file with the environment inside arrows when I have those functions contained in a child of the Global Env. Like this:

install_packages <- function() {

}
<environment: some_child_env>

Anyone yet work around this?

Hi @bikeactuary

I’m not sure I fully understand the issue :thinking:

What is the undesired printing that is happening?

Mine gives like 30 warnings that I ignore, if it runs I don’t even care

this string:
“<environment: some_child_env>”
was being placed in the .R script. It is not valid R code, so it was causing errors like “unexpected character” when sourcing. Because the “<” would not be expected.

Hello @bikeactuary

We are not able to reproduce this behaviour on our side. Can you share an example snippet that would lead to this issue?

We use capture.outputs function to get the source code of the function and to write it to a file.

Let’s disregard this. I was sourcing from the submission_dir at one point which is where this occurs. Its avoidable by just not doing that.

But if you want to reproduce the “error”, simply create an environment and source the functions to that environment before running aicrowd_submit

runEnv <- new.env()
sapply(list.files(“fn_out/”),
function(x) source(paste0(“fn_out/”, x), local = runEnv) )

Then run aicrowd submit and observe the string identifying environment which appears in the submission_dir saved files. I guess your code on the backend ignores/removes this line when processing