Skip to content

Commit 1429967

Browse files
committed
Attempt to resolve issues on Windows
1 parent a0f966e commit 1429967

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

nbgrader/coursedir.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,14 +439,16 @@ def find_notebooks(
439439
}
440440

441441
# Convert to a Path and back to a string to remove any instances of `/.`
442-
pattern = str(Path(pattern.replace(".", r"\.").format(**pattern_args)))
442+
pattern = str(Path(pattern))
443443

444444
if sys.platform == 'win32':
445-
# Escape backslashes on Windows
445+
# Escape backslashes on Windows before doing any other escaping
446446
pattern = pattern.replace('\\', r'\\')
447447

448+
pattern = pattern.replace(".", r"\.").format(**pattern_args)
449+
448450
for file in files:
449-
match = re.match(pattern, str(file.relative_to(self.root)))
451+
match = re.match(pattern, str(file))
450452
if match:
451453
results.append({ **kwargs, **match.groupdict(), "path": file })
452454

0 commit comments

Comments
 (0)