aboutsummaryrefslogtreecommitdiff
path: root/launcher.py
blob: 31713f43277f54fbbdf34d16c1723b6e51327ea1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import idlelib
import os
from subprocess import *

# If I can't find the R path, I could have a dedicated r procedure that finds R.home() and puts that into a text file.

print(os.getcwd())

#open demp.py
# demo_fil = os.path.join(os.getcwd(),'demo.py')
# if os.path.exists(demo_fil):
# 	idle_bat = idlelib.__file__.replace('__init__.py','idle.bat')
# 	Popen(f'{idle_bat} "{demo_fil}"')

tar_fil = os.path.join(os.getcwd(),'demo.r')
print(tar_fil)
if os.path.exists(tar_fil):
	rscript_exe = 'C:/Program Files/R/R-4.2.2/bin/Rscript.exe'
	rscript_exe = 'Rscript'
	print(os.path.exists(rscript_exe))
	run(
		f'{rscript_exe} "{tar_fil}"',
		cwd = os.getcwd(),
		start_new_session = True
		)