datadrivencv icon indicating copy to clipboard operation
datadrivencv copied to clipboard

use_datadriven_cv: "Error: ...datadrivencv/templates/cv.rmd does not exist"

Open drscotthawley opened this issue 4 years ago • 6 comments

Nick, thanks for sharing this. I'm looking forward to making this work.

After the installation seems to complete successfully, I run the following....

datadrivencv::use_datadriven_cv(
 full_name = "Scott H. Hawley",
 data_location = "https://docs.google.com/spreadsheets/d/1DfrWtlHM29bQoHpteUEs_FcrJNCpMSv1OyV3EqMF2QI",
 pdf_location = "https://hedges.belmont.edu/~shawley/cv.pdf",
 html_location = "https://hedges.belmont.edu/~shawley/cv/",
 source_location = "https://github.com/drscotthawley/cv")

(or I can paste in your info, either way)

...and what I get is...

Error: '/home/shawley/anaconda3/envs/spnet/lib/R/library/datadrivencv/templates/cv.rmd' does not exist.

I've tried this in Rstudio and just R from the command line, and i get the same error either way.

Any suggestions on what to do? Thanks.

(btw that /home/shawley/anaconda3/envs/spnet/lib/R/library seems to be the default directory that comes up when I go to Tools > Install Packages in Rstudio).

drscotthawley avatar Jul 19 '20 08:07 drscotthawley

This seems to be a case-sensitivity issue. There is no cv.rmd there, but there is a cv.Rmd. I'm not sure how to edit your scripts, but if I create a symlink

$ ln -s cv.Rmd cv.rmd`

...then the build proceeds to the NEXT case-sensitive error: ...render_cv.r' does not exist. And sure enough there's a render_cv.R file there.

...and then cv_printing_functions.r' does not exist.

..and so it goes with more files. Were these scripts were developed on a case-insensitive file system? ;-)

drscotthawley avatar Jul 19 '20 08:07 drscotthawley

Was just about to file the same issue. E.g.

Error: '/usr/lib/R/library/datadrivencv/templates/cv_printing_functions.r' does not exist.

When the actual file is **CV**_printing_functions.**R**.

The line here coerces the relevant files to lower case. But I'm a bit puzzled as to its purpose, because that would only affect the (string) references in the R session rather than the actual system file names.

~~I think what you'd actually want is a line before these two that coerces the file_name (and output_file_name) to lowercase.~~ EDIT: Sorry, just realised (duh) that my suggestion would result in the same problem; i.e. converting to lower case in R rather than the actual system file. At any rate, this is still the point of failure for me. I suppose another simple solution would be to simply change the template file names to lower case...

grantmcdermott avatar Jul 24 '20 05:07 grantmcdermott

This is because I foolishly tried to standardize on all lowercase after I realized I have been inconsistant with case in my previous releases. I think what I will do to remedy this issue in the future is to make it so the package checks for the file case-insensitive and then pulls whichever version it finds. Shouldn't be hard with the fs package.

nstrayer avatar Jul 26 '20 18:07 nstrayer

For reference I am placing my sketched solution to this issue here.

In the template fetching function: use_ddcv_template() the following logic should be used to find a correct file location instead of just throwing out a raw string and hoping I have written it down properly.

all_templates <- fs::file_ls(system.files("templates/", package = "datadrivencv"))$path
cv_loc <- all_templates[str_detect(all_templates, "render_cv.r")]

(Probably misremembered the syntax here).

I have implemented basic tests that check that the demos work etc so hopefully if it doesn't work the tests will catch it.

nstrayer avatar Jul 26 '20 18:07 nstrayer

ops, I didn't see this one, sorry.. Instead, I commented here #36, but I'm facing the exact same problem too

veroandreo avatar Aug 11 '20 00:08 veroandreo

I made everything lowercase and now it runs :)

veroandreo avatar Aug 11 '20 00:08 veroandreo