Beispiel #1
0
def writeToJSONFile(fileName, data):
    pprint(data)
    filePath = getFilePath(fileName)
    lockfile = QLockFile(getLockfileName(fileName))
    lockfile.lock()

    with open(filePath, 'w') as f:
        json.dump(data, f)

    lockfile.unlock()
Beispiel #2
0
def loadFromFile(file):
    lockfile = QLockFile(getLockfileName(file))
    lockfile.lock()

    if not QFileInfo(file).exists():
        return

    with open(file) as f:
        data = json.load(f)

    return data