def start_processing(self): #print "start processing file..." try: #print self.fileloc.get() #print self.adj.get() tide = Converter() tide.set_input_file(self.fileloc.get()) tide.set_adjustment(int(self.adj.get())) #tide.set_output_file("tide_%d%d%d%d%d%d.txt" % (self.now.year, self.now.month, self.now.day, self.now.hour, self.now.minute, self.now.second)) tide.set_output_file(self.generate_filename()) tide.process_file() tide.close() self.done_processing() except: #print "Unexpected error", tkMessageBox.showerror("Unexpected Error", sys.exc_info())
from converter import Converter import os, sys input_file = raw_input("Enter the location of file you want to convert > ") while not os.path.exists(input_file): print "'%s' not found. " % input_file input_file = raw_input("Please enter again the filename you want to convert > ") while True: adjustment = raw_input("Adjust how many hours? (1 or 2) > ") adjustment = int(adjustment) if adjustment == 1 or adjustment == 2: break if os.path.exists(input_file): output_file = raw_input("Enter the filename of the output file > ") else: pass try: tide = Converter() tide.set_input_file(input_file) tide.set_adjustment(adjustment) tide.set_output_file(output_file) tide.process_file() tide.close() except: print "Unexpected error", sys.exc_info() print "Conversion successful. The new file is: ", output_file raw_input("Press enter to exit")