TwitchDropsMiner
TwitchDropsMiner copied to clipboard
Corrupted image cache mapping file prevents the application from starting
Hi, thanks for making this tool, I really enjoy using it, but I got this error when starting it today:
Traceback (most recent call last):
File "main.py", line 171, in <module>
File "twitch.py", line 621, in __init__
File "gui.py", line 1776, in __init__
File "cache.py", line 41, in __init__
File "utils.py", line 192, in json_load
File "json\__init__.py", line 293, in load
File "json\__init__.py", line 370, in loads
File "json\decoder.py", line 337, in decode
File "json\decoder.py", line 353, in raw_decode
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 674 column 112 (char 23875)
Is it a client-side issue? I got a Windows update today and yesterday before the update it worked, so maybe that caused it?
Hello o/
I have some good and bad news. The good news is that this error is harmless - it's a simple cache file corruption, that can be easily fixed by deleting the cache
folder. Not sure how it could've happened, it could possibly be caused by the operating system somehow closing the file mid-write, or in any way the file write being interrupted unexpectedly. A less likely cause would be some weird URL breaking the JSON encoding, in which case it'd break again when restarted after reconstructing the cache folder. If that'd happen, please let me know.
The "bad but not so bad" news is that, as you can see, the possibility of this happening was not taken into account when creating the cache system, as cache errors can be remedied by recreating the cache. Touching the cache logic code is also a good opportunity for me to finally handle the case of mis-linked images, that could currently, potentially cause the cache folder to grow in size over time. Fortunately the images are small, so this growth is negligible - but still, I'd like for it to be fixed eventually.
Okay so I deleted the cache folder and it started, but now I have another error.
20:28:22: Fatal error encountered:
20:28:22:
20:28:22: Traceback (most recent call last):
20:28:22: File "main.py", line 175, in <module>
20:28:22: File "asyncio\base_events.py", line 616, in run_until_complete
20:28:22: File "twitch.py", line 759, in run
20:28:22: File "twitch.py", line 778, in _run
20:28:22: File "twitch.py", line 1449, in get_auth
20:28:22: File "twitch.py", line 512, in validate
20:28:22: File "twitch.py", line 518, in _validate
20:28:22: File "twitch.py", line 656, in get_session
20:28:22: File "aiohttp\cookiejar.py", line 101, in load
20:28:22: EOFError: Ran out of input
20:28:22:
20:28:22: Exiting...
20:28:23:
20:28:23: Application Terminated.
20:28:23: Close the window to exit the application.
The cause for this error is the exact same - the file was closed before the write could finish populating it's contents. It all seems like you (or something you did) somehow managed to turn the PC off in the exact moment the file was being saved. Because the save operation takes only a fraction of a second, it seems to be very unlucky of you. Force-closing your PC or a power failure can do this. Normally, the operating system won't let you close a file before the write is finished, and there's nothing in the application that'd "half-write" the file either.
To fix this one, just delete your cookies file and login again.
Wow, I'm really unlucky :d. I use a batch script to shut down my pc, maybe that is considered "force closing". Anyways, thanks for your help, it works now 👍🏼
Sure, but these issues still shouldn't prevent the application from starting, so this needs to be reopened. I'll close it myself eventually once these are sorted out. If you're not interested in receiving notifications, you can unsubscribe from this issue.
Apparently this is already fixed by https://github.com/DevilXD/TwitchDropsMiner/commit/2d1dfe007c5e8cc27908e13fe667ce85df106644, and will be available in the next release.