bnosac / taskscheduleR

Schedule R scripts/processes with the Windows task scheduler.
330 stars 72 forks source link

Space Error #45

Closed DavisBrian closed 6 years ago

DavisBrian commented 6 years ago

This is similar to issue #10.

If your R installation location has a space it your script will also fail. For a lot of corporate users we don't have a say as to where R gets installed.

Here we have \\\R. All scripts built with taskscheduleR fail with

'///<directory' is not recognized as an internal or external command, operable program or batch file.

jwijffels commented 6 years ago

What is this Path on your environment? file.path(Sys.getenv("R_HOME"), "bin", "Rscript.exe")

DavisBrian commented 6 years ago

"//vfhomefls01/bdavis07/my documents/R/R-3.4.4/bin/Rscript.exe"

jwijffels commented 6 years ago

Can you use the Rexe argument when you do taskscheduler_createwhere you pass Rexe = shQuote(file.path(Sys.getenv("R_HOME"), "bin", "Rscript.exe"))

jwijffels commented 6 years ago

Do you have any feedback on this solution?

DavisBrian commented 6 years ago

I'll see if I can verify today.

DavisBrian commented 6 years ago

Doesn't seem to fix it.

'//vfhomefls01/bdavis07/my' is not recognized as an internal or external command, operable program or batch file.'

code



## Run script once at a specific timepoint (within 62 seconds)
runon <- format(Sys.time() + 62, "%H:%M")
taskscheduler_create(taskname = "quicktest", rscript = "H:/tmp/helloworld.R", 
                     shQuote(file.path(Sys.getenv("R_HOME"), "bin", "Rscript.exe")),
                     schedule = "ONCE", starttime = runon)

## Have a look at the log
mylog <- system.file("extdata", "helloworld.log", package = "taskscheduleR")
cat(readLines(mylog), sep = "\n")```
jwijffels commented 6 years ago

This doesnt look like you passed the Rexe argument

DavisBrian commented 6 years ago

That seems to have done the trick.

jwijffels commented 6 years ago

If it worked, feel free to close the issue.

DavisBrian commented 6 years ago

interesting is I think I now have a similar issue to #33 now on my actual script. The command window pops up when the task is triggered but no log or output occurs. TaskScheduler says the job completed successfully, but the runt ime is 1 second and I know the script takes about 5 minutes to run. I'll close this and see if I can make a reprex for the new issue.

jwijffels commented 6 years ago

the easy solution to your problem is to put R in a folder without spaces instead of on the location whare you have it now //vfhomefls01/bdavis07/my documents/R/R-3.4.4/bin/Rscript.exe which seems to be a shared drive. Why don't you just copy //vfhomefls01/bdavis07/my documents/R to //vfhomefls01/bdavis07/R This will be very hard to reproduce without having a similar shared drive.

DavisBrian commented 6 years ago

Corporate IT department, don't have options one normally has.