-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Could not decode file: png: invalid format: not enough pixel data #34
Comments
Hi @wnd-rgb thanks for the report, and it’s always awesome to see how the app is being used in the wild! I’d suspect this is an edge case where the file is still being written at the exact time that dau notices it. Has it only happened once? Since there’s no reliable way to know that the file has been completely written this is a thorny case. That said it shouldn’t crash completely and I will investigate that. By what means do you generate the screenshot? Does that process have an option to atomically move or rename the file after writing? That would be a more reliable outcome. |
Yes, its only happened the one time, and dau has been running for many weeks now continuously. The screenshots are generated by listening for a command on twitch, parsing it with python and sending a keyboard shortcut to OBS which generates the screenshot as a png in the same folder that dau watches. Perhaps increasing the watch timer would help? |
Increasing the watch timer would make it less statistically likely to happen, but it could still happen. Ideally, files in the watch dir should be moved in atomically (via a mv command or rename call), then there is no chance they will be partially written. That may be difficult given the way your setup works (you'd have to change OBS to write to a temporary location, and make your python script wait for the file to be written, and then move it to the watch dir). You'd have to deal with the headaches that dau is currently avoiding :-) As part of this issue I will at least make it a non-fatal error if a file is half-written and thus can't be decoded. Making it deal with partial files (with some sort of heuristic, to ignore it and try again next loop) is a more complex change. |
Thanks for this cool program first of all, I'm using it on my 24/7 Earthbound stream at https://twitch.tv/mushguys. Users can issue a command to save a screenshot of the game and send it to the game progress channel. It's very useful. I've had it running for many weeks without issue but it suddenly crashed today. No unusual work load, it is possible that two screenshots were sent close together, and I have the sleep check set to 2 seconds.
The text was updated successfully, but these errors were encountered: