def create_archive_info(filepath, extracted_path, archive_sha=None): """ Saves archive info to a json file :param str filepath: Path to directory of archive :param str extracted_path: Path to directory of archive :param str archive_sha: SHA string created when archive was extracted from zip """ archive_info = { "sha1": archive_sha, "filename": os.path.split(filepath)[1], } with io.open( os.path.join( extracted_path, ".slackviewer_archive_info.json", ), 'w+', encoding="utf-8" ) as f: s = json.dumps(archive_info, ensure_ascii=False) s = to_unicode(s) f.write(s)