-
Notifications
You must be signed in to change notification settings - Fork 236
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
Improve error message when NotebookRunner initialized with a String #705
Conversation
thanks for working on this! at a quick glance, the code looks good. can you check flake8, I'm seeing this in the CI
https://github.com/ploomber/ploomber/blob/master/CONTRIBUTING.md#submitting-code |
if Path(self._primitive).exists(): | ||
raise ValueError( | ||
'{} looks like a path to a file. ' | ||
'Perhaps you meant passing a pathlib.Path object'.format( |
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.
please show a code example as part of the error message:
perhaps you meant passing a pathlib.Path object like this:
from pathlib import Path
NotebookRunner(Path('value-that-the-user-passed'))
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.
please show a code example as part of the error message:
sorry, I dont get the question.
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.
to be more user-friendly, modify the error message so we tell the user how to fix their code (otherwise they need to figure out that they need to add an import and then enclose their string using Path
. it'll make it easier for them to know how to fix it :)
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.
Oh I see your point. make sense to me.
Let me update the error message in the next revision
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.
thanks!
Yes, it seems like I did not run |
bf7925f
to
295da34
Compare
thanks for your contribution! |
Description
This CR includes changes that make
NotebookRunner
initialized with a String explicitly throw an exception if the string looks like apathlib.Path
Tests
Related Issue
#694