Skip to content

Commit 366ae5b

Browse files
committed
Fix path pattern construction on Windows
1 parent dee7e14 commit 366ae5b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

nbgrader/coursedir.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import re
3+
import sys
34
import datetime
45
import typing
56
from pathlib import Path
@@ -367,6 +368,10 @@ def find_assignments(self,
367368
# Convert to a Path and back to a string to remove any instances of `/.`
368369
pattern = str(Path(self.directory_structure.format(**pattern_args)))
369370

371+
if sys.platform == 'win32':
372+
# Escape backslashes on Windows
373+
pattern = pattern.replace('\\', r'\\')
374+
370375
for dir in dirs:
371376
match = re.match(pattern, str(dir.relative_to(self.root)))
372377
if match:

0 commit comments

Comments
 (0)