I have a r Script with the code:
args = commandArgs(trailingOnly=TRUE)
myData <- read.csv(file=args[0])
I want to run this using a GUI and deliver a choosen csv file with this python code
from tkinter import filedialog
from tkinter import *
import subprocess
window = Tk()
window.geometry('500x200')
window.title("Wordcloud Creator")
lbl = Label(window, text="1. Please prepare a CSV (-Trennzeichen) file with the columns untgscod, berpos, SpezX3")
lbl.grid(column=0, row=0)
def runScript():
filename = filedialog.askopenfilename(initialdir = "/",title = "Select file",filetypes = (("csv files","*.csv"),("all files","*.*")))
subprocess.call(['Rscript', 'C:/Users/Name/Desktop/R-GUI/test.r', filename])
btn = Button(window, text="Select a file and start Cloud creation", command=runScript())
btn.grid(column=0, row=1)
window.mainloop()
But unfortunately this is not working. I get this error but do not know what is wrong.
File "c:\Users\name\.vscode\extensions\ms-python.python-2019.2.5558\pythonFiles\lib\python\ptvsd\_vendored\pydevd\_pydev_bundle\pydev_monkey.py", line 444, in new_CreateProcess
return getattr(_subprocess, original_name)(app_name, patch_arg_str_win(cmd_line), *args)
FileNotFoundError: [WinError 2] The system cannot find the file specified
I do not see why the file cannot be found.