UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position

Error

UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position

Most likely it occurs when working with files that contain characters of another alphabet. For example, Cyrillic ones

Perhaps the encoding problem can be solved by declaring the required encoding when opening the file

Replace

with open('your_file','r') as f:

With

with open('your_file','r', encoding="utf8") as f:

↓ Python articles ↓
Development in Python
Interactive mode
Virtual environment
str: strings
\: line break
Lists
Loops
Methods
Functions
*args **kwargs
enum
Determine a Python variable type
Testing with Python
Working with REST API in Python
Files: write, read, append, context manager…
Download a file over the network
SQLite3: working with a database
datetime: Date and Time in Python
Selenium + Python
Difficulties when working with Python
DJANGO
Flask
Script for a ZPL printer
socket :Python Sockets
subprocess: run bash commands from Python
multiprocessing: several processes at once
psutil: system resources
sys.argv: command line arguments
PyCharm: IDE
pydantic: data validation
paramiko: SSH from Python
enumerate
json.dumps

Article author: Andrei Olegovich