Skip to content

Commit a98876a

Browse files
author
Zex
committed
check file type
1 parent 1d50946 commit a98876a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ipynb_to_py.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def to_py(content, path):
2929
relpath = os.path.basename(path).replace('ipynb', 'py')
3030
output = os.path.join(OUTPUT_BASE, \
3131
os.path.dirname(path).replace(os.getcwd()+'/', ''), relpath)
32+
output = output.replace(' ', '')
3233
output_base = os.path.dirname(output)
3334

3435
if not os.path.isdir(output_base):
@@ -40,7 +41,10 @@ def to_py(content, path):
4041

4142

4243
def load_ipynb(base):
43-
list(map(foreach_ipynb, glob.iglob(base+'/*.ipynb')))
44+
if os.path.isfile(base) and base.endswith('.ipynb'):
45+
foreach_ipynb(base)
46+
return
47+
list(map(foreach_ipynb, glob.iglob(os.path.join(base, '*.ipynb'))))
4448

4549

4650
def start_scan(base=None):

0 commit comments

Comments
 (0)