Reputation:
My code:
import subprocess
for file in ('folder_with_all_files'):
a= subprocess.Popen(['my_exe_file.exe',file,'command'],shell=True, stderr=subprocess.STDOUT,stdout=subprocess.PIPE)\ communicate()[0]
Normally in .py
script all goes fine. but when i am trying to put those lines in tkinter
, nothing happens.
Part of Tkinter
code:
def Run():
for file in ('folder_with_all_files'):
a= subprocess.Popen(['my_exe_file.exe',file,'command'],shell=True,
stderr=subprocess.STDOUT,stdout=subprocess.PIPE)\ communicate()[0]
button.configure(command=RUN)
What i am doing wrong? and how to choose only specific extension of files that i want to use, example : .dat only Thanks
EDIT: i have also tried:
def Run():
filenames=os.listdir('folder_with_all_files')
for file in filenames:
a= subprocess.Popen(['my_exe_file.exe',file,'command'],shell=True,
stderr=subprocess.STDOUT,stdout=subprocess.PIPE)\ communicate()[0]
even when i am adding direct path to file doesnt work
a= subprocess.Popen(['my_exe_file.exe','direct path/file','command']
but still doesnt work
Upvotes: 0
Views: 398
Reputation:
Problem was connected with files, i was showing only the path to the folder, and program didnt know which files should use.
this line of code helped me to solve the problem, and get specific extension of the files:
filenames= glob.glob(os.path.join('path',"*.xxx"))
Cheers
Upvotes: 1