T
Tim Churches
Benjamin said:hello,
i have been attempting to run BATCH jobs on WinXP/Server2003 using
Python. It seems that my questions are similar to those of a previous
OPs. Unfortunately, what seemed like a simple question/request either
digressed or was misinterpreted to the tune of 19 posts:
Author: Moosebumps
Subject (1): Batch commands on Windows
Subject (2): os.system always opens new window on Windows XP/2000
here is the operation that works, but isn't actually carried out in
Python:
Start->Run "cmd" ***command line appears***
then i enter the following commands (i copied and pasted the whole
session so that you can see exactly what i did):
******************************************************
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\BRdir>cd c:\Applications\R\rw1091\bin
C:\Applications\R\rw1091\bin>Rcmd BATCH c:\test.txt
C:\Applications\R\rw1091\bin>
******************************************************
now, the whole point here is to send the following R script to the
program c:\Applications\R\rw1091\bin\Rcmd.exe, i.e. the file cited as
"c:\test.txt" contains the following code:
********************************************************
library(lattice)
x<-read.csv('C:\\Data\\EData\\eFile.txt')
a<-as.matrix(x[,1])
b<-as.matrix(x[,2])
c<-as.matrix(x[,3])
X11()
levelplot(c~a*b)
savePlot(filename='c:\\test2',type='jpeg')
********************************************************
now, the procedure i have just outlined works absolutely perfect. i
have spent some time trying to do this from Python; this includes
looking at posts and references from everywhere i was able to find
them. i still can't run an analogous procedure from python. i have
attempted to use os.system, the popen family. i feel like part of the
issue is that i can't find enough simple examples on how to use these
tools.
Have you considered RPy, which embeds R in Python? See http://rpy.sf.net
Tim C