当前位置:Gxlcms > 数据库问题 > Django项目与mysql交互进行数据迁移时报错:AttributeError: 'str' object has no attribute 'decode'

Django项目与mysql交互进行数据迁移时报错:AttributeError: 'str' object has no attribute 'decode'

时间:2021-07-01 10:21:17 帮助过:9人阅读

出现如下错误:

  File "/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/operations.py", line 147, in last_executed_query
    query = query.decode(errors=replace)
AttributeError: str object has no attribute decode

 解决办法

顺着报错信息,找到报错的位置,把

query = query.decode(errors=replace) 修改成 query = query.encode(errors=replace)

 

 

 

 

Django项目与mysql交互进行数据迁移时报错:AttributeError: 'str' object has no attribute 'decode'

标签:code   位置   erro   col   man   local   exe   ast   项目   

人气教程排行