Skip to content

Commit 8b945d6

Browse files
committed
fix
1 parent 5f34b50 commit 8b945d6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ def openfile(path):
5050
btnopenlast = ttk.Button(root, text="Open last file", command=lambda: openfile(path=content))
5151
btnopenlast.pack(anchor="nw", padx=20, pady=20)
5252

53-
file = open("lastfile.txt", "r")
54-
content = file.read()
55-
file.close()
53+
if os.path.isfile("lastfile.txt"):
54+
file = open("lastfile.txt", "r")
55+
content = file.read()
56+
file.close()
5657

5758
if not os.path.isfile(content): btnopenlast.configure(state="disabled")
5859

0 commit comments

Comments
 (0)