Beispiel #1
0
def process(input_file_name, output_file_name):
    exporter = Exporter()

    try:
        decks = exporter.read_and_convert_decks(input_file_name)
    except Exception:
        print("Error while reading CSV file:")
        raise

    try:
        exporter.output_decks(decks, output_file_name)
    except Exception:
        print("Error while writing CSV file:")
        raise

    return len(decks)
Beispiel #2
0
    def do_conversion(self):
        exporter = Exporter()
        decks = None
        try:
            exporter.verify_input_file(self.input_file_name.get())
        except Exception as ex:
            messagebox.showwarning("Invalid File", ex)
            raise

        try:
            decks = exporter.read_and_convert_decks(self.input_file_name.get())
        except Exception as ex:
            messagebox.showerror("Could not convert",
                                 "Error while reading CSV file.")
            raise

        try:
            exporter.output_decks(decks, self.output_file_name.get())
        except Exception as ex:
            messagebox.showerror("Could not convert",
                                 "Error while writing CSV file.")
            raise

        messagebox.showinfo("Success", f'{len(decks)} decks converted.')