[R] PythonInR. Python script in R with parameters required. Download satellite images from NASA

Collin Lynch cflynch at ncsu.edu
Sun Aug 2 04:51:56 CEST 2015


Magi, is there a reason that you need to run the script via R? If your
plan is to download the data via python than then process with R, you
might consider using the Rpy2 package to link them.  This would allow
you to call the downloading code from python and then have python feed
the data to R.

    Collin.

On Wed, Jul 29, 2015 at 12:29 PM, Magi Franquesa
<magifranquesa at gmail.com> wrote:
> Hello,
>
> I'm trying to execute a python script within R (3.2.1 x 64) with the
> PythonInR package. I would like to download an order of satellite images
> from Nasa using a python script (
> http://landsat.usgs.gov/documents/espa_bulk_downloader_v1.0.0.zip) but I
> have no success. I first run the pyExecfile command with the *feedparser.py*
> script and then the *download_espa_order.py* giving the required parameters
> (my mail acount and the order number), here is the code:
>
> setwd("C:/Python27")
> install.packages("PythonInR")
> library(PythonInR)
> pyConnect(pythonExePath="C:/Python27/python.exe")
> pyIsConnected()
> # autodetectPython("C:/Python27/python.exe")
>
> pyExecfile("C:/Landsat/feedparser.py")
> pyExecfile("C:/Landsat/download_espa_order.py" -e "magifranquesa at gmail.com"
> -o "magifranquesa at gmail.com-07222015-120911" -d "C:/Landsat/ESPA")
>
> and I get this error:
>
> Error: unexpected string constant in
> "pyExecfile("C:/Landsat/download_espa_order.py" -e
> "magifranquesa at gmail.com""
>
> The code "C:/Landsat/download_espa_order.py" -e
> "magifranquesa at gmail.com" -o "magifranquesa at gmail.com-07222015-120911"
> -d "C:/Landsat/ESPA" runs ok when I use it within
> system console.
>
> I appreciate if someone could help me to solve this problem.
>
> Thank you
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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