Hi I am working in Tkinter and have built a frame that asks for a file to open and then opens that file to run code with it,
import subprocess
import pandas as pd
import Tkinter as tk
class MonthlyMenu(tk.Frame):
def __init__(self,parent,controller):
tk.Frame.__init__(self,parent)
self.controller = controller
self.browsefile = tk.StringVar()
self.fileentry = tk.Entry(self, textvariable = self.browsefile,).grid(row=1,column=1,sticky=tk.W+tk.E)
self.submitFile = tk.Button(self,text="Ok",command=self.openFile).grid(row=1,column=2,sticky = tk.W+tk.E)
def openFile(self):
self.browsefile.get()
filename = self.browsefile.get()
df = pd.read_excel(filename, sheename="Sheet1",parse_col=0)
titles = list(df.columns)
for col in titles:
sa_command = "C:\\X12\\x12a.exe %s" % (col)
process = subprocess.Popen(sa_command,stdout=subprocess.PIPE)
process.wait()
But the last part of that code running the executable with subprocess is not running. There is other code in that for loop that runs and builds the correct files to run that executable, but I didn't think it was necessary to show everything. I have tried breaking the subprocess code out of the for loop and manually passing the titles, but that hasn't worked either.
All the other files that I create in that for loop are working correctly, and I have run just the subprocess code on its own (in a .py file with just that code) with those files and it works correctly then. I am wondering if anyone knows if it is an issue with trying to run it within the class that is causing this issue, or if I am just missing something.