Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Check file path for animation and raise if it does not exist #25238

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

Merged
merged 1 commit into from
Feb 23, 2023

Conversation

oscargus
Copy link
Member

PR Summary

Closes #25233

Not clear to me how to check it. As in how the animation testing actually works... Once setup, I am sure how to test for the particular error.

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

@dstansby
Copy link
Member

An alternative way to do this which would shift the error handling upstream, would be call path.resolve(strict=True), which will raise an error if the path doesn't exist (https://docs.python.org/3/library/pathlib.html?highlight=pathlib#pathlib.Path.resolve)

@anntzer
Copy link
Contributor

anntzer commented Feb 19, 2023

[Side point: I did not know about the Path.resolve() trick to move error generation to the stdlib itself; it is nice because you can actually get the FileNotFoundError, PermissionError, or whatnot. (Perhaps the call should really be Path.stat(), though, as can be seen by looking at the implementation of Path.exists()). From a quick skim through the library, I think the only other place where we could switch to using it is at the start of matplotlib.testing.compare.convert().]

timhoffm
timhoffm previously approved these changes Feb 20, 2023
Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI failures look real

@timhoffm timhoffm dismissed their stale review February 20, 2023 11:27

CI failures

@oscargus
Copy link
Member Author

It was indeed real... Wasn't sure if it was local so went ahead.

The class structure could really need an update. Now, one cannot call super().setup() as that calls _run as part of setup, which is not possible for a FileWriter class.

@oscargus
Copy link
Member Author

OK, this should now be good to go. OS-dependent tests added.

@QuLogic QuLogic added this to the v3.7.1 milestone Feb 23, 2023
@QuLogic QuLogic merged commit 17db60b into matplotlib:main Feb 23, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Feb 23, 2023
oscargus added a commit that referenced this pull request Feb 23, 2023
…238-on-v3.7.x

Backport PR #25238 on branch v3.7.x (Check file path for animation and raise if it does not exist)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MNT]: FFMpegWriter does not check if out path exists when initialized.
6 participants