gogrepoc icon indicating copy to clipboard operation
gogrepoc copied to clipboard

Latest commits broke the script

Open PauloGDPeixoto opened this issue 7 months ago • 14 comments

I'm having errors while trying to update the manifest file. Every game gives an error similar to the following:

22:19:55 | (  1 / 901) fetching game details for 140_game...
22:20:04 |   -> title has changed "140_game" -> "140"
22:20:04 | The handled exception was:
22:20:04 | error
Traceback (most recent call last):
  File "/run/media/2844327D5A8D495D/gog/../gogrepoc/gogrepoc.py", line 313, in __getattr__
    return self[key]
           ~~~~^^^^^
KeyError: 'folder_name'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/run/media/2844327D5A8D495D/gog/../gogrepoc/gogrepoc.py", line 1715, in cmd_update
    handle_game_updates(gamesdb[item_idx], item,strict)
  File "/run/media/2844327D5A8D495D/gog/../gogrepoc/gogrepoc.py", line 657, in handle_game_updates
    if olditem.folder_name != newitem.folder_name:
                              ^^^^^^^^^^^^^^^^^^^
  File "/run/media/2844327D5A8D495D/gog/../gogrepoc/gogrepoc.py", line 315, in __getattr__
    raise AttributeError(key)
AttributeError: folder_name
22:20:04 | End exception report.

PauloGDPeixoto avatar Dec 21 '23 22:12 PauloGDPeixoto

Could you let me know what Python version you use ? The current build is identical to the one I use day to day so I suspect this is either me missing a Python 2 backwards compatibility issue or a Python 3 deprecation from a newer version than I run.

On Fri, 22 Dec 2023, 08:25 Paulo Peixoto, @.***> wrote:

I'm having errors while trying to update the manifest file. Every game gives an error similar to the following:

22:19:55 | ( 1 / 901) fetching game details for 140_game... 22:20:04 | -> title has changed "140_game" -> "140" 22:20:04 | The handled exception was: 22:20:04 | error Traceback (most recent call last): File "/run/media/ppeixoto/2844327D5A8D495D/gog/../gogrepoc/gogrepoc.py", line 313, in getattr return self[key] ~~~~^^^^^ KeyError: 'folder_name'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/run/media/ppeixoto/2844327D5A8D495D/gog/../gogrepoc/gogrepoc.py", line 1715, in cmd_update handle_game_updates(gamesdb[item_idx], item,strict) File "/run/media/ppeixoto/2844327D5A8D495D/gog/../gogrepoc/gogrepoc.py", line 657, in handle_game_updates if olditem.folder_name != newitem.folder_name: ^^^^^^^^^^^^^^^^^^^ File "/run/media/ppeixoto/2844327D5A8D495D/gog/../gogrepoc/gogrepoc.py", line 315, in getattr raise AttributeError(key) AttributeError: folder_name 22:20:04 | End exception report.

— Reply to this email directly, view it on GitHub https://github.com/Kalanyr/gogrepoc/issues/98, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKZ3372JU5MYZTJKJQVXZDYKSZLXAVCNFSM6AAAAABA7A5N52VHI2DSMVQWIX3LMV43ASLTON2WKOZSGA2TGMJSHA3TSNA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Kalanyr avatar Dec 22 '23 01:12 Kalanyr

I'm using python 3.12. And I can confirm that reverting three commits (to commit 948cbf0), the script works as expected.

PauloGDPeixoto avatar Dec 22 '23 15:12 PauloGDPeixoto

Hmm, I'm running 3.11 so it must be an intersection of those changes and 3.12 that's annoying, I'm not seeing anything that should cause errors from the 3.12 changelog at a glance (might be from modules that have been updated that I haven't updated too I guess ).

I'll install python 3.12 and see if I can find the problem.

Kalanyr avatar Dec 23 '23 04:12 Kalanyr

Ahh, okay, it's not 3.12 I think, you've somehow got new items in your manifest that aren't in the updated format, I don't understand how that's possible but I can write some code to account for the situation.

Kalanyr avatar Dec 23 '23 05:12 Kalanyr

I see a 2nd possible issue which is that there's apparently a game with a slug that's just a number now, which is not ideal but lets see if solving problem 1 resolves your immediate issues before I have to dive into python Attribute rules.

Could you please try the attached file and let me know if it solves your issue ?

gogrepoc-troubleshoot.zip

Kalanyr avatar Dec 23 '23 05:12 Kalanyr

First of all, thanks for being so prompt! This issue happened to all items, the first one just happens to have a number for a name, but the same error repeats for all games. The items in the manifest that aren't in the updated format sounds plausible, although I've been using gogrepoc for some time now, it seems weird to have this issue now, specially considering that a rollback to the script fixes the issue.

Anyway, I apologize, but I'll be offline for the weekend, I can test the manifest you mentioned next Monday night.

PauloGDPeixoto avatar Dec 23 '23 15:12 PauloGDPeixoto

In this case it's a tiny format update introduced in the recent commits which avoids a weird edge case when GOG does something bizarre ( renames a game but then almost immediately introduces a new game with the same short name as the renamed game IIRC )

On Sun, 24 Dec 2023, 01:00 Paulo Peixoto, @.***> wrote:

First of all, thanks for being so prompt! This issue happened to all items, the first one just happens to have a number for a name, but the same error repeats for all games. The items in the manifest that aren't in the updated format sounds plausible, although I've been using gogrepoc for some time now, it seems weird to have this issue now, specially considering that a rollback to the script fixes the issue.

Anyway, I apologize, but I'll be offline for the weekend, I can test the manifest you mentioned next Monday night.

— Reply to this email directly, view it on GitHub https://github.com/Kalanyr/gogrepoc/issues/98#issuecomment-1868311067, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKZ334USLEHAGI5DNXIJTLYK3W2XAVCNFSM6AAAAABA7A5N52VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRYGMYTCMBWG4 . You are receiving this because you commented.Message ID: @.***>

Kalanyr avatar Dec 23 '23 15:12 Kalanyr

I see a 2nd possible issue which is that there's apparently a game with a slug that's just a number now, which is not ideal but lets see if solving problem 1 resolves your immediate issues before I have to dive into python Attribute rules.

Could you please try the attached file and let me know if it solves your issue ?

gogrepoc-troubleshoot.zip

This does indeed solve the issue! Below is a a bit of output:

22:29:33 | loading local manifest...
22:29:34 | loading token...
22:29:34 | loading local resume manifest...
22:29:34 | incomplete update detected, resuming...
22:29:34 | saving resume manifest...
22:29:35 | saved resume manifest
22:29:35 | (  1 / 900) fetching game details for 140_game...
22:29:35 | refreshing token
22:29:35 | saving token...
22:29:35 | saved token
22:29:35 | refreshed token
22:29:39 |   -> title has changed "140_game" -> "140"
22:29:39 |   -> folder name has changed "140_game" -> "140"
22:29:39 | (  2 / 900) fetching game details for 15_days...
22:29:42 |   -> title has changed "15_days" -> "15 Days"
22:29:42 |   -> folder name has changed "15_days" -> "15 Days"
22:29:42 | (  3 / 900) fetching game details for 1954_alcatraz...
22:29:46 |   -> title has changed "1954_alcatraz" -> "1954 Alcatraz"
22:29:46 |   -> folder name has changed "1954_alcatraz" -> "1954 Alcatraz"
22:29:46 | (  4 / 900) fetching game details for 198x...
22:29:54 |   -> title has changed "198x" -> "198X"
22:29:54 |   -> folder name has changed "198x" -> "198X"
22:29:54 | (  5 / 900) fetching game details for 1nsane...
22:29:58 | (  6 / 900) fetching game details for a_bird_story...
22:30:08 |   -> title has changed "a_bird_story" -> "A Bird Story"
22:30:08 |   -> folder name has changed "a_bird_story" -> "A Bird Story"

PauloGDPeixoto avatar Dec 26 '23 22:12 PauloGDPeixoto

Hmm, that's not right those aren't necessarily valid folder names, it's using the long form name rather than the short one. I'll have to look into this further.

I need to test this on Python 3.12 I think.

On Wed, 27 Dec 2023, 08:31 Paulo Peixoto, @.***> wrote:

I see a 2nd possible issue which is that there's apparently a game with a slug that's just a number now, which is not ideal but lets see if solving problem 1 resolves your immediate issues before I have to dive into python Attribute rules.

Could you please try the attached file and let me know if it solves your issue ?

gogrepoc-troubleshoot.zip https://github.com/Kalanyr/gogrepoc/files/13758070/gogrepoc-troubleshoot.zip

This does indeed solve the issue! Below is a a bit of output:

22:29:33 | loading local manifest... 22:29:34 | loading token... 22:29:34 | loading local resume manifest... 22:29:34 | incomplete update detected, resuming... 22:29:34 | saving resume manifest... 22:29:35 | saved resume manifest 22:29:35 | ( 1 / 900) fetching game details for 140_game... 22:29:35 | refreshing token 22:29:35 | saving token... 22:29:35 | saved token 22:29:35 | refreshed token 22:29:39 | -> title has changed "140_game" -> "140" 22:29:39 | -> folder name has changed "140_game" -> "140" 22:29:39 | ( 2 / 900) fetching game details for 15_days... 22:29:42 | -> title has changed "15_days" -> "15 Days" 22:29:42 | -> folder name has changed "15_days" -> "15 Days" 22:29:42 | ( 3 / 900) fetching game details for 1954_alcatraz... 22:29:46 | -> title has changed "1954_alcatraz" -> "1954 Alcatraz" 22:29:46 | -> folder name has changed "1954_alcatraz" -> "1954 Alcatraz" 22:29:46 | ( 4 / 900) fetching game details for 198x... 22:29:54 | -> title has changed "198x" -> "198X" 22:29:54 | -> folder name has changed "198x" -> "198X" 22:29:54 | ( 5 / 900) fetching game details for 1nsane... 22:29:58 | ( 6 / 900) fetching game details for a_bird_story... 22:30:08 | -> title has changed "a_bird_story" -> "A Bird Story" 22:30:08 | -> folder name has changed "a_bird_story" -> "A Bird Story"

— Reply to this email directly, view it on GitHub https://github.com/Kalanyr/gogrepoc/issues/98#issuecomment-1869802569, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKZ33Z4CNWBSCPKPEBVRQLYLNF3PAVCNFSM6AAAAABA7A5N52VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRZHAYDENJWHE . You are receiving this because you commented.Message ID: @.***>

Kalanyr avatar Dec 26 '23 23:12 Kalanyr

This is absolutely bizarre I just tried logging in on Python 3.12 and it all works properly (folders are correctly generated with the short name), I did get one deprecation warning but it's unrelated to your issue..

You're obviously using Linux though and I don't have a Linux test environment available right now (my Linux environment is currently busted and I'm probably not going to have a chance to fix it for at least a couple of weeks ).

Kalanyr avatar Dec 27 '23 00:12 Kalanyr

hmm Could you try backing up your gog-manifest.dat and gog-resume-manifest.dat file somewhere, then deleting the current ones and letting it run an update (don't try to download as the renamed folders will break the recognition )

If you could send a copy of the original gog-manifest.dat and gog-resume-manifest.dat to my email ( kalanyrDeleteTheseWords AT gmail DOT com ) that would be very helpful, I'll see if there's enough information in there to write a script to fix the folder names for you.

Kalanyr avatar Dec 27 '23 00:12 Kalanyr

hmm Could you try backing up your gog-manifest.dat and gog-resume-manifest.dat file somewhere, then deleting the current ones and letting it run an update (don't try to download as the renamed folders will break the recognition )

If you could send a copy of the original gog-manifest.dat and gog-resume-manifest.dat to my email ( kalanyrDeleteTheseWords AT gmail DOT com ) that would be very helpful, I'll see if there's enough information in there to write a script to fix the folder names for you.

Currently doing this, but it will take some time, I'll send it to you as soon as it's done, thanks!

PauloGDPeixoto avatar Dec 29 '23 22:12 PauloGDPeixoto

hmm Could you try backing up your gog-manifest.dat and gog-resume-manifest.dat file somewhere, then deleting the current ones and letting it run an update (don't try to download as the renamed folders will break the recognition )

If you could send a copy of the original gog-manifest.dat and gog-resume-manifest.dat to my email ( kalanyrDeleteTheseWords AT gmail DOT com ) that would be very helpful, I'll see if there's enough information in there to write a script to fix the folder names for you.

Email sent!

PauloGDPeixoto avatar Dec 30 '23 23:12 PauloGDPeixoto

From what I can guess you had some quite old data in your resume manifest and it's very hard to detect / correct that ( many of the fields are supposed to be empty ) by contrast I do my best to have the proper manifest detect and handle older versions ( The actual manifest shouldn't be written too until it's well defined which makes it easier)

I'll probably need to come up with some kind of version stamp for the resume manifest and just ignore it, if it's outdated.

I hadn't even considered that possibility.

On Sun, 31 Dec 2023, 09:08 Paulo Peixoto, @.***> wrote:

hmm Could you try backing up your gog-manifest.dat and gog-resume-manifest.dat file somewhere, then deleting the current ones and letting it run an update (don't try to download as the renamed folders will break the recognition )

If you could send a copy of the original gog-manifest.dat and gog-resume-manifest.dat to my email ( kalanyrDeleteTheseWords AT gmail DOT com ) that would be very helpful, I'll see if there's enough information in there to write a script to fix the folder names for you.

Email sent!

— Reply to this email directly, view it on GitHub https://github.com/Kalanyr/gogrepoc/issues/98#issuecomment-1872623299, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKZ335ZEN3SSLFCVCMBZLLYMCNINAVCNFSM6AAAAABA7A5N52VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZSGYZDGMRZHE . You are receiving this because you commented.Message ID: @.***>

Kalanyr avatar Dec 31 '23 01:12 Kalanyr