Skip to content
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

Handle OSErrors in a cleaner way #1187

Closed
3 tasks done
biggestsonicfan opened this issue Nov 8, 2022 · 0 comments
Closed
3 tasks done

Handle OSErrors in a cleaner way #1187

biggestsonicfan opened this issue Nov 8, 2022 · 0 comments

Comments

@biggestsonicfan
Copy link
Contributor

biggestsonicfan commented Nov 8, 2022

Prerequisites

Description

For the first time in my history of using PixivUtil2, my Pixiv backup drive ran out of space and all chaos seemed to ensue. For some reason, the logs did not log this information, which I thought was strange, it just printed it out to the console. As I've experienced in the past, when OSErrors are thrown, PixivUtil2 downloads them to the executing directory. So if a 4 MiB image can't be written to the destination, it downloads it to the PixivUtil2 folder... but if there's enough space to update db.sqlite, it does so with the originally intended destination. So the database now has an invalid entry as the file will not be there. I have verified this against all the images that saved to my PixivUtil2 folder (except icon and banner art), and only 1 image saved as the filename itself, ignoring the config.ini for some reason.

If you're running a batch file, or have stepped away from PixivUtil2 to play a game or surf the net, I don't think OSErrors should just be allowed to continue. I think these exceptions should be handled like KeyboardInterrupt, where it prompts if you want to continue. If you get an "Invalid Argument" or "No space left on device" error, chances are it's not going to fix itself during the entire download queue you have left. PixivUtil2 should halt and allow the user to attempt to take care of the problem before continuing, or be allowed to abort then and there. No one wants to wade through a PixivUtil2 folder with hundreds or thousands of images in it, I'm sure.

UPDATE EDIT: Okay, apparently I thought all the images in the PixivUtil2 folder didn't make it to the destination path, but I was wrong. Those images were downloaded regardless that they existed in the destination path. I don't know why this is.

Steps to Reproduce

This will be left as an exercise to whomever wants to attempt to tackle this. My suggestion would be to use VirtualBox and add a very small created drive, maybe 20 megabytes, an set that to the PixivUtil2's destination.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants