0

I am building a Shiny app using golem, and I need to use exiftool to rename photos. After using usethis::use_package('exifr') in my 02_dev.R script, exifr::read_exif() works fine, but when the app hits my system call to use exiftool (system('exiftool ...')), it gives the error "Warning: Error in system: 'exiftool' not found." I have exiftool and strawberry PERL installed on my computer (strawberry is in the C: drive), and I tried copying exiftool into my inst/app/www/ folder, but I am still getting the same message.

Edit: here is the full command that triggers the error: system("exiftool -r -d %Y%m%d_%H%M%S \"-filename<SWWLF2021/${userlabel;s/ //g}/",vals$pcode,"_${userlabel;s/ //g}_${DateTimeOriginal}_${triggermode;s/(.)(.*\\s)(.)(.*)/$1$3/}${sequence;s/(\\d)(.*)/_$1/}.%e\" " where userlabel, DateTimeOriginal, triggermode, and sequence are all part of the photo metadata.

Is there a call I should be using in my 02_dev.R, or in golem_add_external_resources() in my app_ui script?

tamarack
  • 377
  • 1
  • 11
  • 1
    It sounds like you didn't add the path to `exiftool` to your system path. You can use `exifr::configure_exiftool(command="")` to tell the program where you installed `exiftool`. If `read_exif` works fine, what command exactly triggers the error? It's a bit tough to guess what's happening without a simple minimal [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) to look at and run. – MrFlick Oct 28 '21 at 21:38
  • Thanks! I couldn't really add a reproducible example because it is reading metadata from photos off the user's computer, so it's not running just in R. What specifically should be in that `configure_exiftool()` call? I installed exiftool.exe into the inst/app/www folder inside my golem app, and I added the line `exifr::configure_exiftool(command='inst/app/www/')` to my UI, and it's still having that error. I'll work on a reproducible example, but I should also note that the same command works out of a non-golem project, so it has something to do with how a golem project looks for exiftool. – tamarack Oct 29 '21 at 17:01
  • What kind of non-golem project are you using exactly? Is the path to the tool in your `$PATH` environment variable? Does `Sys.which("exiftool")` in R return a path? Can you run it from the command line outside of R by just typing "exiftool"? The `command=` should be the full, absolute path to the `exiftool` program, ending in `exiftool` some thhing like `exifr::configure_exiftool(command='/home/user/apps/exiftool/bin/exiftool')` or whatever is correct for your OS/where you installed it. – MrFlick Oct 29 '21 at 17:08

0 Answers0