On Thu, Jun 4, 2015 at 8:47 AM, Wall, Wade A ERDC-RDE-CERL-IL < wade.a.w...@usace.army.mil> wrote:
> Hi all, > > I am trying to pass arguments to a python script using R, but am running > into a problem with the string being split on the white spaces. > Investigation on the python end suggests that it is happening upstream from > python, because other shells such as bash have generated similar errors. > > Here is example code. > > R script: > > test = "./Example.py" > string1 = "ThisWorks" > string2 = "This doesn't" > > system2('python',args = c(as.character(test),as.character(string1))) ## > This works > system2('python',args = c(as.character(test),as.character(string2))) ## > This doesn't > use shQuote, like: system2('python',args=shQuote(c(as.character(test),as.character(string2)))) > Python script: > > from sys import argv > script, string = argv > print script > print string > > What happens is that string 2 is splits into "This" and "doesn't". Does > anyone know how to resolve this issue? Of course I can remove the white > spaces, but that may be somewhat inconvenient. > > Thanks for any help. > > Wade > > [[alternative HTML version deleted]] > Please don't use HTML email. It often causes messages to be unreadable, although not in this particular case. > > ______________________________________________ > R-help@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. > -- My sister opened a computer store in Hawaii. She sells C shells down by the seashore. If someone tell you that nothing is impossible: Ask him to dribble a football. He's about as useful as a wax frying pan. 10 to the 12th power microphones = 1 Megaphone Maranatha! <>< John McKown [[alternative HTML version deleted]] ______________________________________________ R-help@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.