[Solved] Python Error: Attributeerror: ‘STR’ object has no attribute ‘decode’

Solution:
The above problem occurs find: Python37\lib\site-packages\django\db\backends\mysql\operations.py".

Open and modify the inside: query = query.decode(errors='replace') to query = query.encode(errors='replace') and you're done.

vim /usr/local/python3/lib/python3.6/site-packages/django/db/backends/mysql/operations.py

query = query.decode(errors='replace') Change to: query = query.encode(errors='replace')

Similar Posts: