diff --git a/tools/setup/emoji/build_emoji b/tools/setup/emoji/build_emoji index 1a8289d675..f63344054d 100755 --- a/tools/setup/emoji/build_emoji +++ b/tools/setup/emoji/build_emoji @@ -202,9 +202,14 @@ def dump_emojis(cache_path): # type: (str) -> None subprocess.call('ttx -v -z extfile -d {} NotoColorEmoji.ttf'.format(EMOJI_DUMP_DIR_PATH), shell=True) - emoji_map = ujson.load(open('emoji_map.json')) + with open('emoji_map.json') as emoji_map_file: + emoji_map = ujson.load(emoji_map_file) + code_point_to_fname_map = code_point_to_file_name_map(EMOJI_DUMP_PATH("NotoColorEmoji.ttx")) - emoji_data = ujson.load(open(os.path.join(EMOJI_DATA_PATH, 'emoji.json'))) + + EMOJI_DATA_FILE_PATH = os.path.join(EMOJI_DATA_PATH, 'emoji.json') + with open(EMOJI_DATA_FILE_PATH) as emoji_data_file: + emoji_data = ujson.load(emoji_data_file) emoji_catalog = generate_emoji_catalog(emoji_data) UNIFIED_REACTIONS_PATH = os.path.join(ZULIP_PATH, 'zerver', 'management', 'data', 'unified_reactions.json')