Fix unlinks
This commit is contained in:
parent
fc251281a8
commit
8ab5de6b19
1 changed files with 14 additions and 6 deletions
|
|
@ -76,9 +76,13 @@ def serve() -> None:
|
|||
|
||||
finally:
|
||||
if args.file_name.endswith(".ipynb"):
|
||||
Path(get_script_name_of_notebook(args.file_name)).unlink(
|
||||
missing_ok=True
|
||||
)
|
||||
try:
|
||||
Path(get_script_name_of_notebook(args.file_name)).unlink(
|
||||
missing_ok=True
|
||||
)
|
||||
except FileNotFoundError:
|
||||
# missing_ok only exists >= Python 3.8
|
||||
pass
|
||||
else:
|
||||
|
||||
class EventHandler(PatternMatchingEventHandler):
|
||||
|
|
@ -124,9 +128,13 @@ def serve() -> None:
|
|||
observer.stop()
|
||||
restart_handler.stop_server()
|
||||
if args.file_name.endswith(".ipynb"):
|
||||
Path(get_script_name_of_notebook(args.file_name)).unlink(
|
||||
missing_ok=True
|
||||
)
|
||||
try:
|
||||
Path(get_script_name_of_notebook(args.file_name)).unlink(
|
||||
missing_ok=True
|
||||
)
|
||||
except FileNotFoundError:
|
||||
# missing_ok only exists >= Python 3.8
|
||||
pass
|
||||
observer.join()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue