I am trying to start a program and write a saved CSV file to it.
I have the following code to start the program, that works fine:
os.startfile('C:\Program Files\Files\CSV_Reader')
But I'm not sure how to open the CSV File. I tried a few other options like:
os.system('start CSV_Reader.exe "{0}C:\Program Files\Files\card_kingdom.csv"'.format(sys.path[0], ))
But I get the following error message:
C:\Users\JJ\AppData\Local\Programs\Python\Python36\python.exe C:/Users/JJ/PycharmProjects/Buylist/CK_file_test The system cannot find the file CSV_Reader.exe.
I know that the directory is right, because when I call the os.startfile
function it opens the program.
Your help would be much appreciated!
You can use popen like it:
import subprocess
subprocess.Popen(["C:\Program Files\Files\CSV_Reader.exe" , "C:\Program Files\Files\card_kingdom.csv"])