omegahat / RDCOMClient

GNU General Public License v2.0
80 stars 35 forks source link

R 4.1.2 and RDCOMClient 0.94 R Session Aborted #36

Closed Kiwi31131 closed 2 years ago

Kiwi31131 commented 2 years ago

Hi everyone, So it all started as I wanted to run this code:

require(RDCOMClient)
wsh <- COMCreate("Wscript.Shell")
wsh$SendKeys("{LEFT}")

And here my R sessionn aborted.

I read #24 and #32 as well as the Stackoverflow page. Maybe here I must say that I am definitly NOT an experienced programmer.

I went first with:

dir <- tempdir()
> zip <- file.path(dir, "RDCOMClient.zip")
> url <- "https://github.com/dkyleward/RDCOMClient/releases/download/v0.94/RDCOMClient_binary.zip"
> download.file(url, zip)
trying URL 'https://github.com/dkyleward/RDCOMClient/releases/download/v0.94/RDCOMClient_binary.zip'
Error in download.file(url, zip) : 
  cannot open URL 'https://github.com/dkyleward/RDCOMClient/releases/download/v0.94/RDCOMClient_binary.zip'
In addition: Warning message:
In download.file(url, zip) :
  cannot open URL 'https://github.com/dkyleward/RDCOMClient/releases/download/v0.94/RDCOMClient_binary.zip': HTTP status was '404 Not Found'

So after that I tried:

library(remotes)
> remotes::install_github("BSchamberger/RDCOMClient", ref = "main")
Downloading GitHub repo BSchamberger/RDCOMClient@main
√  checking for file 'C:\Users\kiwi\AppData\Local\Temp\RtmpQzbGpq\remotes5f6c1d875a5\BSchamberger-RDCOMClient-68c94c5/DESCRIPTION' (386ms)
-  preparing 'RDCOMClient':
√  checking DESCRIPTION meta-information ...
-  cleaning src
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
-  building 'RDCOMClient_0.94-0.tar.gz'

Installiere Paket nach ‘C:/Users/kiwi/Documents/R/win-library/4.1’
(da ‘lib’ nicht spezifiziert)
* installing *source* package 'RDCOMClient' ...
ERROR: cannot remove earlier installation, is it in use?
* removing 'C:/Users/kiwi/Documents/R/win-library/4.1/RDCOMClient'
* restoring previous 'C:/Users/kiwi/Documents/R/win-library/4.1/RDCOMClient'
Warnung in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE)
  Problem C:\Users\kiwi\Documents\R\win-library\4.1\00LOCK-RDCOMClient\RDCOMClient\libs\x64\RDCOMClient.dll nach C:\Users\kiwi\Documents\R\win-library\4.1\RDCOMClient\libs\x64\RDCOMClient.dll zu kopieren: Permission denied
Warning message:
In i.p(...) :
  installation of package ‘C:/Users/kiwi/AppData/Local/Temp/RtmpQzbGpq/file5f6c7e8d591/RDCOMClient_0.94-0.tar.gz’ had non-zero exit status

And here I can't find any other solution. I will spare you all my other attempts. I guess I'm too close to the wall to see the top, as they say back home. If anyone has any idea... thank you very much for your time and your work here !

praf62 commented 2 years ago

I have the same problem, Kiwi31131. Could some one help us?

LinuxOrNot commented 2 years ago

I have the same problem, Kiwi31131. Could some one help us?

Me too.

alcantarams commented 2 years ago

Same here. I was trying with these lines in R 4.1.0 / RStudio 1.4.1103: OutApp <- COMCreate("Outlook.Application") outMail = OutApp$CreateItem(0)

And it keeps crashing.

Kiwi31131 commented 2 years ago

Hi guys, thank you for commenting. I felt quite lonely! Up to now, I still haven't found the solution.

duncantl commented 2 years ago

Hi. 2 possible causes, one way to resolve it.

Create a directory and use that to install the package not in R's own set of packages (i.e. not in C:/..../R/win-library/4.1)

dir.create("MyTemp")
remotes::install_github("BSchamberger/RDCOMClient", ref = "main", lib = "MyTemp")

If that is successful, you can then load the newly installed package with

library("RDCOMClient", lib.loc = "MyTemp")

However, you probably want to install it in the regular location and not have to specify lib.loc when loading the package in the future. There are several ways to do this, but let's use the regular approach of installing it in the usual location.

The 2 possible causes of the problem are 1) there is an R session running that has already loaded the RDCOMClient package and that puts a lock on the files in R/win-library/4.1/RDCOMClient and install_github()/install.packages() cannot remove that previously installed package to install the new package. So make certain to kill any R session that may have loaded RDCOMClient, including the one you in which you are trying to install it from. 2) you don't have write permission for the R/win-library/4.1/ directory

praf62 commented 2 years ago

Thank you very much, duncantl. Following you my code works perfectly :)

Kiwi31131 commented 2 years ago

Also worked for me. Thank you so much !