Background
python 3.7.6
django 2.2
Phenomenon
Execute Python manage Error in py makemigrations:
File "E:\software\Python3-64bit\lib\site-packages\django\db\backends\mysql\operations.py", line 146, in last_executed_query
query = query.decode(errors='replace')
AttributeError: 'str' object has no attribute 'decode'
reason:
The reason is unknown. This problem will occur in some versions.
Solution:
Modify line 146 of {PYHTON_HOME}\lib\site-packages\django\db\backends\mysql\operations.py to change
query = query.decode(errors=’replace’) to query = query.encode(errors=’replace’)
Read More:
- [Solved] AttributeError: ‘str‘ object has no attribute ‘decode‘
- [Solved] AttributeError: ‘str‘ object has no attribute ‘decode‘
- Djangorestframework-simplejwt: ‘str‘ object has no attribute ‘decode‘ [Solved]
- [Solved] Pytorch-transformers Error: AttributeError: ‘str‘ object has no attribute ‘shape‘
- How to Solve Python AttributeError: ‘module’ object has no attribute ‘xxx’
- AttributeError str object has no attribut [How to Solve]
- [2021-10-05] Python Error: AttributeError: ‘NoneType‘ object has no attribute ‘append‘
- [Modified] AttributeError: ‘socket‘ object has no attribute ‘ioctl‘ python linux
- How to Solve Python AttributeError: ‘dict’ object has no attribute ‘item’
- [Solved] Python Keras Error: AttributeError: ‘Sequential‘ object has no attribute ‘predict_classes‘
- Python Openyxl Error: AttributeError: ‘int‘ object has no attribute ‘upper‘ [How to Solve]
- [Solved] python Error: AttributeError: ‘NoneType‘ object has no attribute ‘split‘
- Python writes DICOM file (attributeerror: ‘filemetadataset’ object has no attribute ‘transfersyntax uid’ solution)
- [Solved] Python Selenium Error: AttributeError: ‘WebDriver‘ object has no attribute ‘find_element_by_xpath‘
- [Solved] AttributeError: ‘NoneType‘ object has no attribute ‘astype‘
- [Solved] AttributeError: ‘Manager‘ object has no attribute ‘get_by_natural_key‘
- [Solved] Paramiko error: AttributeError: ‘NoneType’ object has no attribute ‘time’
- [Solved] Add-apt-repository Command Error: AttributeError: ‘Thread‘ object has no attribute ‘isAlive‘
- [Solved] AttributeError: ‘PngImageFile‘ object has no attribute ‘imshow‘
- [Solved] vpython: AttributeError: ‘box‘ object has no attribute ‘idx‘