I'm trying to create Skype patcher with replaced font (stock is incorrectly displaying japanese kanji as chinese equivalent) for Windows. Maybe Python is not the best options, but current problem is not related with Python itself: asar utility produces output with readonly permissions, and changing permission attempt can't do anything. But, maybe, os.chmod is just not working on Windows?


import tkinter as tk
from tkinter import filedialog
import subprocess
import os
import shutil


def change_permissions_recursive(path, mode):
    for root, dirs, files in os.walk(path, topdown=False):
        for dir in [os.path.join(root,d) for d in dirs]:
            os.chmod(dir, mode)
    for file in [os.path.join(root, f) for f in files]:
            os.chmod(file, mode)


root = tk.Tk()
root.withdraw()
dir_path = filedialog.askdirectory(initialdir="C:\Program Files (x86)\Microsoft\Skype for Desktop")
cmd = "asar.cmd extract \"" + dir_path + "/resources/app.asar\" tmp/app"
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, creationflags=0x08000000, cwd="utils")
process.wait()
change_permissions_recursive("utils/tmp/app/fonts", 0o777)
shutil.copyfile("utils/meiryo.ttf", "utils/tmp/app/fonts")
Something wrong with shutil.copy itself: when rewrite same logic with powershell, all works as expected
Python chmod for windows