Webshot failed to take snapshot in Ubuntu machine

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Webshot failed to take snapshot in Ubuntu machine

Bogaso
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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Webshot failed to take snapshot in Ubuntu machine

Bogaso
Also the Session information.

> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.4 LTS

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] pdftools_2.0  webshot_0.5.1

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.19     ps_1.1.0         crayon_1.3.4     assertthat_0.2.0
 [5] R6_2.3.0         jsonlite_1.5     magrittr_1.5     pillar_1.3.0
 [9] rlang_0.2.2      debugme_1.1.0    callr_3.0.0      tools_3.4.4
[13] compiler_3.4.4   processx_3.2.0   base64enc_0.1-3  tibble_1.4.2

On Tue, Dec 18, 2018 at 6:07 PM Christofer Bogaso <
[hidden email]> wrote:

> 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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Webshot failed to take snapshot in Ubuntu machine

R help mailing list-2
In reply to this post by Bogaso
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

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]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Webshot failed to take snapshot in Ubuntu machine

Bogaso
Is there any alternative to webshot?

On Tue, Dec 18, 2018 at 6:23 PM Marc Girondot <[hidden email]> wrote:

> 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
>
> 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]]
> >
> > ______________________________________________
> > [hidden email] 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.
>
>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Webshot failed to take snapshot in Ubuntu machine

Martin Maechler
In reply to this post by R help mailing list-2
>>>>> 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]]
    >>
    >> ______________________________________________
    >> [hidden email] 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.

    > ______________________________________________
    > [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Webshot failed to take snapshot in Ubuntu machine

Bogaso
Thanks Martin,

I reinstalled PhantomJS and now it works fine. Regards,

On Thu, Dec 20, 2018 at 5:30 PM Martin Maechler <[hidden email]>
wrote:

> >>>>> 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]]
>     >>
>     >> ______________________________________________
>     >> [hidden email] 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.
>
>     > ______________________________________________
>     > [hidden email] 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.