Skip to content

encoding Default/Preferences #2173

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

Open
dmitry30 opened this issue Apr 7, 2025 · 0 comments
Open

encoding Default/Preferences #2173

dmitry30 opened this issue Apr 7, 2025 · 0 comments

Comments

@dmitry30
Copy link

dmitry30 commented Apr 7, 2025

fix exit_type flag to prevent tab-restore nag

    try:
        with open(
            os.path.join(user_data_dir, "Default/Preferences"),
            encoding="latin1",
            mode="r+",
        ) as fs:
            config = json.load(fs)
            if config["profile"]["exit_type"] is not None:
                # fixing the restore-tabs-nag
                config["profile"]["exit_type"] = None
            fs.seek(0, 0)
            json.dump(config, fs)
            fs.truncate()  # the file might be shorter
            logger.debug("fixed exit_type flag")
    except Exception as e:
        logger.debug("did not find a bad exit_type flag ")

Why encoding latin1?
I have a utf-8 encoded settings file.
after overwriting it, there are problems with recoding and it increases in size.

Image

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

No branches or pull requests

1 participant