(Attempt 1): Command in the button executes without showing the button widget. (I would like the user click browse button to select the file)
(Attempt 2): If I use **lambda** then the next chunk of code immediately after the button gets executed throwing error. As the **merge\_doc = MailMerge(file\_name)** gets its file\_name only after the button command gets executed. Please suggest.

Attempt 1
=========

```
from tkinter import *
from tkinter import ttk
from mailmerge import MailMerge
import tkinter as tk
import os
from tkinter import filedialog
import tkinter.font as font

root = tk.Tk()
root.geometry("")
root.title("Test")

file_name=""

def main():
    global file_name
    file = filedialog.askopenfile(initialdir="./")
    if file: 
        file_name=file.name

browse_button = Button(root, text ='BROWSE',command=main())
browse_button.grid(row=1, column=0, padx=10, ipadx=25,ipady=35)
browse_button.grid_forget()

merge_doc = MailMerge(file_name)

```

Attempt 2
=========

```
from tkinter import *
from tkinter import ttk
from mailmerge import MailMerge
import tkinter as tk
import os
from tkinter import filedialog
import tkinter.font as font

root = tk.Tk()
root.geometry("")
root.title("Test")

file_name=""

def main():
    global file_name
    file = filedialog.askopenfile(initialdir="./")
    if file: 
        file_name=file.name

browse_button = Button(root, text ='BROWSE',command=lambda:main())
browse_button.grid(row=1, column=0, padx=10, ipadx=25,ipady=35)
browse_button.grid_forget()

merge_doc = MailMerge(file_name)

```

Error thrown during Attempt 2:

```
Traceback (most recent call last):
File "C:\Users\Rocky\Desktop\TEST\Testnew.py", line 30, in <module>
merge_doc = MailMerge(file_name)
File "C:\Python38\lib\site-packages\mailmerge.py", line 25, in __init__
self.zip = ZipFile(file)
File "C:\Python38\lib\zipfile.py", line 1251, in __init__
self.fp = io.open(file, filemode)
FileNotFoundError: [Errno 2] No such file or directory: ''

```