Skip to content

How to get Mu's user configuration from user program #1856

Answered by aroberge
aroberge asked this question in Q&A
Discussion options

You must be logged in to vote

I found the answer to my own question.

import json
import os
import appdirs

DATA_DIR = appdirs.user_data_dir(appname="mu", appauthor="python")
try:
    with open(os.path.join(DATA_DIR, "session.json")) as fp:
        settings = json.load(fp)
except FileNotFoundError:
    settings = {}
    
if 'theme' in settings:
    print(settings['theme'])
if 'locale' in settings:
    print(settings['locale'])

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by aroberge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant