1

I'm using robjects to execute an R script from python. When R finishes it leaves behind it many temporary files. I can't modify the R script but I also don't see there any reference to tempfile() so I assume it is coming from a library the R script is using. I tried deleting these files from python at the end of the script run but they are locked by some process. I assumed that if there is a live R interpreter running, closing it will release these files. I tried calling robject.r("quit()") but that killed my python process as well. Any ideas why? How can I close only the R interpreter from robjects? I prefer not to kill the R interpreter using the OS.

user1942586
  • 153
  • 1
  • 3
  • 16
  • What do you mean by "temporary files"? `R` is pretty good at cleaning up after itself; if there are actual files on your disk then I'm surprised that quitting `R` deletes them. – Carl Witthoft Nov 27 '14 at 13:53
  • Well, it's either R or python's 'robjects' that keeping these files but they were definitely created by R as they are placed under R's tempdir() and match the pattern of files created by R's tempfile() – user1942586 Nov 27 '14 at 17:00
  • `tempfile` and `tempdir` just create names, i.e. character strings. You'll have to verify what function (in `R` or in `Python`) actually uses those names, as a start. --- then, I suppose, figure out what genius forgot to remove the temporary directory. – Carl Witthoft Nov 27 '14 at 17:30

0 Answers0