New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Img filename metadata #685
Conversation
This looks fine to me. I might even go further and throw an error if two outputs in one notebook have the same filename. |
How does that check feel? It looked like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good, thanks! I think the error message should explain a bit more, though.
@@ -102,6 +106,13 @@ def preprocess_cell(self, cell, resources, cell_index): | |||
out.metadata.setdefault('filenames', {}) | |||
out.metadata['filenames'][mime_type] = filename | |||
|
|||
if filename in resources['outputs']: | |||
raise ValueError( | |||
"Your filename: {} appears more than once. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this message could be a bit clearer - imagine a user who has got a notebook from someone else and is trying to convert it. Even if someone wrote it themselves, they might accidentally duplicate a filename by copying a cell.
Let's mention that this is a filename associated with an output, which nbconvert is now saving to a separate file, and that the name has come from output metadata.
Love the detailed error message! :-) |
closes #671
this should overwrite files if they are already present.
It also will add an extension to the file if it is not already present.
I'm open to changing either of those behaviours.