From 27d5998a678bf86651a0dcbb6353ba1f7786c4ab Mon Sep 17 00:00:00 2001 From: Parteek Goyal Date: Sun, 6 Aug 2023 21:12:24 +0530 Subject: [PATCH] Update contribute.py --- contribute.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contribute.py b/contribute.py index bb70f7b..c648261 100644 --- a/contribute.py +++ b/contribute.py @@ -59,7 +59,7 @@ def commitAndUpdateRef(repo,tree_content,commit,branch): def appendBlobInTree(repo,content,file_path,tree_content): - blob = repo.create_git_blob(content,'ascii') + blob = repo.create_git_blob(content,'utf-8') tree_content.append( github.InputGitTreeElement(path=file_path,mode="100644",type="blob",sha=blob.sha)) @@ -152,6 +152,7 @@ def decode_token(encoded_token): try: for root, dirs, files in os.walk(STUDY_NAME_PATH): + files = [f for f in files if not f[0] == '.'] for filename in files: path = f"{root}/{filename}" print(path) @@ -160,7 +161,7 @@ def decode_token(encoded_token): image = file.read() content = base64.b64encode(image).decode('utf-8') else: - with open(file=path, mode='r',encoding='ascii') as file: + with open(file=path, mode='r') as file: content = file.read() file_path = f'{DIR_PATH+remove_prefix(path,STUDY_NAME_PATH)}' if(platform.uname()[0]=='Windows'): file_path=file_path.replace("\\","/")