Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot open file 'data-raw/config.yaml': No such file or directory with golem shiny app #899

Open
gabrielburcea opened this issue Aug 11, 2022 · 4 comments

Comments

@gabrielburcea
Copy link

hello all,

I am getting some error

cannot open file 'data-raw/config.yaml': No such file or directory

config.yaml is a file with paths, app version , variable renaming etc. which I have placed it into data-raw. I am not sure how to work with these types of files. This is where the repo is: https://github.com/gabrielburcea/gtdepmap/tree/devel_golem

TO NOTE: I did not work yet with modules, thus keep in mind, as I need to understand how complex is, will take it step by step , after I succeed runing the app the way I set it as of now, then I will add the modules.

@ColinFay
Copy link
Member

Hey,

data-raw is supposed to contain the script to build the internal dataset, so this is not where you'll put your external resources.

In a golem app, if you have an external resource to include, you can add it to inst/

Then,

L inst/
  L this.yaml

can be read with app_sys("this.yaml")

L inst/
  L that / 
    L this.yaml

can be read with app_sys("that/this.yaml")

@gabrielburcea
Copy link
Author

Hey Colin,

I have added the file to inst. And read it like this:

my_yaml = yaml::yaml.load_file(app_sys("inst/config.yaml"))

But I get an error:

Error: object 'path_to_bem' not found

In app_server path_to_bem isn't recognized although it is within config.yaml

in app_server , line 23, where the path_to_bem appears isn't recognised:

CCLECRISPRAchilles = data.frame(fread(file=file.path(path_to_bem,ccle_crispr_file_reldir), sep=","), row.names=1, check.names=F)

@gabrielburcea
Copy link
Author

gabrielburcea commented Aug 12, 2022

I have added the features of my own config.yaml to golem-config.yaml . Yet, I get warnings and errors when testing the package through build function:

Warning (test-golem-recommended.R:43:5): golem-config works
incomplete final line found on '/home/kkwf800/gtdepmap/inst/golem-config.yml'
Backtrace:
 1. testthat::expect_false(...)
      at test-golem-recommended.R:43:4
 4. gtdepmap::get_golem_config("app_prod", config = "dev", file = config_file)
 5. config::get(value = value, config = config, file = file, use_parent = use_parent)
      at gtdepmap/R/app_config.R:38:2
 6. yaml::yaml.load_file(file, eval.expr = FALSE, handlers = list(expr = function(x) parse(text = x)))
 9. base::readLines(con, warn = readLines.warn)

Warning (test-golem-recommended.R:55:1): (code run outside of test_that())
cannot open file 'inst/golem-config.yaml': No such file or directory
Backtrace:

  1. shiny::testServer(...)
    at test-golem-recommended.R:55:0
  2. gtdepmap server(input = session$input, output = session$output, session = session)
  3. yaml::yaml.load_file("inst/golem-config.yaml")
    at gtdepmap/R/app_server.R:31:2
  4. base::readLines(con, warn = readLines.warn)

Error (test-golem-recommended.R:55:1): (code run outside of test_that())
Error: cannot open the connection
Backtrace:

  1. shiny::testServer(...)
    at test-golem-recommended.R:55:0
  2. gtdepmap server(input = session$input, output = session$output, session = session)
  3. yaml::yaml.load_file("inst/golem-config.yaml")
    at gtdepmap/R/app_server.R:31:2
  4. base::readLines(con, warn = readLines.warn)

@gabrielburcea
Copy link
Author

I am reading here https://engineering-shiny.org/golem.html but I cannot see anything about where I can set my paths to the data directory that is external to the app package I am building.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants