Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"system error 5, Access is denied" : On Windows 10, cannot take screenshot #98

Open
engti opened this issue Aug 6, 2020 · 0 comments
Open

Comments

@engti
Copy link

engti commented Aug 6, 2020

On a windows 10 laptop, I am unable to take screenshots. When I issue the command, I get an error.

> webshot("http://rstudio.github.io/leaflet/", "screenshot.png")
Error in rethrow_call(c_processx_exec, command, c(command, args), stdin,  : 
  create process 'C:\Users\username\AppData\Roaming/PhantomJS/phantomjs.exe' (system error 5, Access is denied.
) @win/processx.c:1042 (processx_exec)

And then I used last.error.trace to get

Stack trace:

 1. webshot:::webshot("http://rstudio.github.io/leaflet/", "screenshot.png")
 2. webshot:::phantom_run(args)
 3. callr::process$new(phantom_bin, args = args, stdout = "|", stderr = "|",  ...
 4. .subset2(public_bind_env, "initialize")(...)
 5. processx:::process_initialize(self, private, command, args, stdin,  ...
 6. rethrow_call(c_processx_exec, command, c(command, args), stdin,  ...

 x create process 'C:\Users\username\AppData\Roaming/PhantomJS/phantomjs.exe' (system error 5, Access is denied.
) @win/processx.c:1042 (processx_exec)

Additional Info

Installed the webshot package by:
remotes::install_github("wch/webshot")

Installed the Phantom JS dependency:

install_phantomjs(version = "2.1.1",
                  baseURL = "https://github.com/wch/webshot/releases/download/v0.3.1/",
                  force = FALSE)

Permissions

Then I took a look at the permissions of the folder where Phantom JS is installed. And found it to be "Read Only". Screenshot below.
Folder Location: C:\Users\username\AppData\Roaming

Resetting permission did not help. Opening the permissions tab again, showed that it was back to its "Read Only" status.

image

Thoughts

Perhaps if we install the Phantom JS dependency on another folder, it might help?
Is there a way for me to set the install directory path for Phantom JS to another place on my device?

Looking at the install_phantomjs function, there is the following block:

    if (is_windows()) {
        zipfile <- sprintf("phantomjs-%s-windows.zip", 
            version)
        download(paste0(baseURL, zipfile), zipfile, mode = "wb")
        utils::unzip(zipfile)
        zipdir <- sub(".zip$", "", zipfile)
        exec <- file.path(zipdir, "bin", "phantomjs.exe")
    }

Is there a temporary fix I can use?

Thanks for reading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant