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

Fix ValueError: invalid mode: 'rUb' #69

Open
mikomuto opened this issue Jan 2, 2023 · 5 comments
Open

Fix ValueError: invalid mode: 'rUb' #69

mikomuto opened this issue Jan 2, 2023 · 5 comments
Labels

Comments

@mikomuto
Copy link

mikomuto commented Jan 2, 2023

File mode U is deprecated in Python 3 https://docs.python.org/3/library/functions.html#open

@mikomuto
Copy link
Author

mikomuto commented Jan 2, 2023

Full error generated with Python 3.11:

E:\GOG Games>gogrepo.py update
13:06:14 | loading local manifest...
13:06:14 | fatal...
Traceback (most recent call last):
File "E:\GOG Games\gogrepo.py", line 1170, in
main(process_argv(sys.argv))
File "E:\GOG Games\gogrepo.py", line 1145, in main
cmd_update(args.os, args.lang, args.skipknown, args.updateonly, args.id)
File "E:\GOG Games\gogrepo.py", line 607, in cmd_update
gamesdb = load_manifest()
^^^^^^^^^^^^^^^
File "E:\GOG Games\gogrepo.py", line 257, in load_manifest
with codecs.open(MANIFEST_FILENAME, 'rU', 'utf-8') as r:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 906, in open
ValueError: invalid mode: 'rUb'

@eddie3
Copy link
Owner

eddie3 commented Jan 5, 2023

Thanks. Will fix this.

@eddie3 eddie3 added the bug label Jan 5, 2023
@WisdomCode
Copy link

WisdomCode commented Jul 21, 2023

Just as a quick fix for anyone having this problem, at least on linux systems, find the line and replace 'rU' with 'r' (simply remove the U), and it should work again.
On other OSses, the keyword newline might be necessary (something like
codecs.open(MANIFEST_FILENAME, 'r', 'utf-8', newline="\r\n") as r: may be needed in windows, untested!)

@kristroy
Copy link

kristroy commented Aug 7, 2023

Just tried the fix from @WisdomCode on my Windows10 system and found that removing the U was enough; adding a newline argument returned TypeError: open() got an unexpected keyword argument 'newline'. Hope this helps!

@pchristod
Copy link

Worked for me as well on Windows, thanks!

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

No branches or pull requests

5 participants