-
Notifications
You must be signed in to change notification settings - Fork 740
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
Invalid default screenshot file name in Windows. #993
Labels
bug
Something isn't working
Comments
Good catch, thanks. |
davep
added a commit
to davep/textual
that referenced
this issue
Oct 24, 2022
This extends the set of reserved characters that are guarded against when auto-generating a screenshot filename. The extension covers the most likely candidates taken from: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions This could be spun out into a more general filename cleaning function, which takes OS and filesystem into account and covers every single reserved character, but for the purposes of this bit of code this should be more than enough. Addresses Textualize#993.
davep
added a commit
to davep/textual
that referenced
this issue
Oct 25, 2022
As per this suggestion: Textualize#995 (comment) the default time format changes to one with no problematic characters within it. For the moment at least I'm going to keep the stripping of reserved characters as the user of the code could still pass in problematic format strings. See Textualize#993.
Did we solve your problem? Glad we could help! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Default screenshot filename format in App.save_screenshot (specifically time_format) results in colons in the default file name. This is invalid in Windows.
OSError: [Errno 22] Invalid argument: './textual demo 2022-10-23 16:00:23 341765.svg'
An additional replace call here is probably needed: https://github.com/Textualize/textual/blob/main/src/textual/app.py#L538
The text was updated successfully, but these errors were encountered: