You need rpy2 for Python and also the foreign
package installed in R. You do that by starting R and typing install.packages("foreign")
. You can then quit R and go back to Python.
Then this:
import rpy2.robjects as robjects
robjects.r("require(foreign)")
robjects.r('x=read.csv("test.csv")')
robjects.r('write.dta(x,"test.dta")')
You can construct the string passed to robjects.r
from Python variables if you want, something like:
robjects.r('x=read.csv("%s")' % fileName)