From 9af86a9e495fa9b2d43e82163a1b6fef8129f40f Mon Sep 17 00:00:00 2001 From: Antik21 Date: Sat, 15 Jun 2024 16:51:33 +0700 Subject: [PATCH] Update balance.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Падение в случае ошибки запроса На обработке случая: {"text": f"Нет данных для аккаунта {account_id}", "value": 0} UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-2: character maps to --- modules/balance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/balance.py b/modules/balance.py index cee90de..f99fbf8 100644 --- a/modules/balance.py +++ b/modules/balance.py @@ -122,7 +122,7 @@ def main(): thread.join() total_balance = 0 - with open(output_filename, 'w') as file: + with open(output_filename, 'w', encoding='utf-8') as file: for account_data in accounts: account_id = account_data[0] # Получение ID аккаунта result = results.get(account_id, {"text": f"Нет данных для аккаунта {account_id}", "value": 0})