Skip to content

Commit a1b7715

Browse files
committed
fixes #1539
1 parent cb403fa commit a1b7715

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

nbdev/cli.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,12 @@ def watch_export(nbs:str=None, # Nb directory to watch for changes
188188
def _export(e,lib=lib):
189189
p = e.src_path
190190
if (not '.ipynb_checkpoints' in p and p.endswith('.ipynb') and not Path(p).name.startswith('.~')):
191-
if e.event_type == 'modified': run(f'nb_export --lib_path {lib} "{p}"')
191+
if e.event_type == 'modified':
192+
time.sleep(0.1)
193+
try: run(f'nb_export --lib_path {lib} "{p}"')
194+
except IOError:
195+
time.sleep(0.3)
196+
run(f'nb_export --lib_path {lib} "{p}"')
192197
with fs_watchdog(_export, nbs):
193198
while True: time.sleep(1)
194199

nbs/api/13_cli.ipynb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,12 @@
330330
" def _export(e,lib=lib):\n",
331331
" p = e.src_path\n",
332332
" if (not '.ipynb_checkpoints' in p and p.endswith('.ipynb') and not Path(p).name.startswith('.~')):\n",
333-
" if e.event_type == 'modified': run(f'nb_export --lib_path {lib} \"{p}\"')\n",
333+
" if e.event_type == 'modified':\n",
334+
" time.sleep(0.1)\n",
335+
" try: run(f'nb_export --lib_path {lib} \"{p}\"')\n",
336+
" except IOError:\n",
337+
" time.sleep(0.3)\n",
338+
" run(f'nb_export --lib_path {lib} \"{p}\"')\n",
334339
" with fs_watchdog(_export, nbs):\n",
335340
" while True: time.sleep(1)"
336341
]

0 commit comments

Comments
 (0)