Skip to content

Instantly share code, notes, and snippets.

@takluyver
Created March 26, 2012 09:51
Show Gist options
  • Save takluyver/2204230 to your computer and use it in GitHub Desktop.
Save takluyver/2204230 to your computer and use it in GitHub Desktop.
rpy2 setup.py change for Python 3.
r_exec = os.path.join(r_home, 'bin', 'R')
# Changed ---------------------------------------
import subprocess
rp = subprocess.check_output([r_exec, '--version'], stderr=subprocess.STDOUT).decode('ascii').splitlines()
rversion = rp[0]
# Twist if 'R RHOME' spits out a warning
if rversion.startswith("WARNING"):
rversion = rp[1]
# End of changed section ------------------------
m = re.match('^R ([^ ]+) ([^ ]+) .+$', rversion)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment