Skip to content

Commit

Permalink
Add some more informative error messages in zip collect
Browse files Browse the repository at this point in the history
  • Loading branch information
jhamrick committed May 31, 2017
1 parent 71d318c commit 5ddcf6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion nbgrader/apps/zipcollectapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def _collect_files(self, src_files):
info = self.collector_plugin_inst.collect(_file)
if not info or info is None:
self.log.warning(
"Skipped submission with no match information provided.")
"Skipped submission with no match information provided: {}".format(_file))
invalid_files += 1
continue

Expand Down
12 changes: 6 additions & 6 deletions nbgrader/plugins/zipcollect.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ def _match(self, filename):
match = re.match(self.named_regexp, filename)
if not match or not match.groups():
self.log.warning(
"Regular expression '{}' did not match anything in filename."
"".format(self.named_regexp)
"Regular expression '{}' did not match anything in: {}"
"".format(self.named_regexp, filename)
)
return None

gd = match.groupdict()
self.log.debug(
"Regular expression '{}' matched\n'{}' in filename."
"".format(self.named_regexp, gd)
"Regular expression '{}' matched\n'{}' in: {}"
"".format(self.named_regexp, gd, filename)
)
return gd

Expand Down Expand Up @@ -183,11 +183,11 @@ def collect(self, submitted_file):
Note: ``file_id`` MUST include the the relative path to the
assignment if you are collecting files in assignment sub-folders.
"""
root, ext = os.path.splitext(submitted_file)
_, ext = os.path.splitext(submitted_file)

# Skip any files without the correct extension
if ext not in self.valid_ext:
self.log.debug("Invalid file extension {}".format(ext))
self.log.debug("Invalid file extension {}: {}".format(ext, submitted_file))
return None

groupdict = self._match(submitted_file)
Expand Down

0 comments on commit 5ddcf6c

Please sign in to comment.