mirror of
https://github.com/1j01/textual-paint.git
synced 2024-12-21 22:01:31 +03:00
Handle FileNotFoundError coming from os.path.samefile
This commit is contained in:
parent
61d1532552
commit
ec4d044f8a
7
paint.py
7
paint.py
@ -1229,10 +1229,11 @@ class PaintApp(App):
|
||||
if self.directory_tree_selected_path:
|
||||
filename = os.path.join(self.directory_tree_selected_path, filename)
|
||||
if filename:
|
||||
if self.filename and os.path.samefile(filename, self.filename):
|
||||
window.close()
|
||||
return
|
||||
try:
|
||||
# Note that os.path.samefile can raise FileNotFoundError
|
||||
if self.filename and os.path.samefile(filename, self.filename):
|
||||
window.close()
|
||||
return
|
||||
with open(filename, "r") as f:
|
||||
content = f.read() # f is out of scope in go_ahead()
|
||||
def go_ahead():
|
||||
|
Loading…
Reference in New Issue
Block a user