[R] Webshot failed to take snapshot in Ubuntu machine

Martin Maechler m@echler @ending from @t@t@m@th@ethz@ch
Thu Dec 20 13:00:11 CET 2018


>>>>> Marc Girondot via R-help 
>>>>>     on Tue, 18 Dec 2018 13:53:34 +0100 writes:

    > Hi Christofer, I just try on MacOSX and ubuntu and it
    > works on both:

    > For ubuntu:
    >> Sys.info()
    >                                        sysname
    >                                       "Linux"
    >                                       release
    >                           "4.15.0-42-generic"
    >                                       version "#45-Ubuntu
    > SMP Thu Nov 15 19:32:57 UTC 2018"
    >                                      nodename
    >                                "lepidochelys"
    >                                       machine
    >                                      "x86_64"

    > Not sure what to do...
    > Marc

Hmm, if I try it (on my Linux desktop), I get

  > library(webshot)
  > url <- "https://www.bseindia.com/stock-share-price/asian-paints-ltd/asianpaint/500820/"
  > webshot(url, 'bb.pdf')
  PhantomJS not found. You can install it with webshot::install_phantomjs(). If it is installed, please make sure the phantomjs executable can be found via the PATH variable.
  NULL

So, it is clear this relies on extra javascript based software
being available on your computer, *and* having that correctly in
your PATH.

On my linux system, I then did
   webshot::install_phantomjs()
and that downloaded things and installed a 67 Megabyte
executable in my PATH ... which then subsequently worked.

On that Linux system it did *not* work, try

  system("which phantomjs")

and you should see that it gets a version of 'phantomjs' on your
computer, i.e., the one that  webshot() will then try to use and
somehow fails.

I'd recommend you run   webshot::install_phantomjs()
which then should install a "better" version of the 'phantomjs'
executable that then *should* work ..

Let us know if this helped (or why not).

Best,
Martin Maechler
ETH Zurich

    > Le 18/12/2018 à 13:37, Christofer Bogaso a écrit :
    >> Hi,
    >> 
    >> I was using webshot package to take snapshot of a webpage
    >> as below:
    >> 
    >> library(webshot) webshot('
    >> https://www.bseindia.com/stock-share-price/asian-paints-ltd/asianpaint/500820/',
    >> 'bb.pdf')
    >> 
    >> However what I see is a Blank PDF file is saved.
    >> 
    >> However if I use the same code in my windows machine it
    >> is able to produce correct snapshot.
    >> 
    >> Below is my system information
    >>> Sys.info()
    >> sysname "Linux" release "4.4.0-139-generic" version
    >> "#165-Ubuntu SMP Wed Oct 24 10:58:50 UTC 2018" nodename
    >> "ubuntu-s-2vcpu-4gb-blr1-01" machine "x86_64" login
    >> "root" user "root" effective_user "root"
    >> 
    >> Any idea what went wrong would be highly helpful.
    >> 
    >> Thanks,
    >> 
    >> [[alternative HTML version deleted]]
    >> 
    >> ______________________________________________
    >> R-help using r-project.org mailing list -- To UNSUBSCRIBE and
    >> more, see https://stat.ethz.ch/mailman/listinfo/r-help
    >> PLEASE do read the posting guide
    >> http://www.R-project.org/posting-guide.html and provide
    >> commented, minimal, self-contained, reproducible code.

    > ______________________________________________
    > R-help using r-project.org mailing list -- To UNSUBSCRIBE and
    > more, see https://stat.ethz.ch/mailman/listinfo/r-help
    > PLEASE do read the posting guide
    > http://www.R-project.org/posting-guide.html and provide
    > commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list