AttributeError: 'module' object has no attribute 'setdefaultencoding'

前端 未结 4 503
春和景丽
春和景丽 2020-11-28 13:23

I try to install xadmin (it\'s a django\'s plugin for use the backoffice with twitter\'s bootstrap). But when I run my project, I have the following error in my PyCharm term

4条回答
  •  清歌不尽
    2020-11-28 13:50

    Clearly the xadmin project is strictly Python-2. You can patch that one file easily, just turn the last two lines into

    if sys.version[0] == '2':
        reload(sys)
        sys.setdefaultencoding("utf-8")
    

    and send the tiny patch to the maintainers of xadmin. However it's very unlikely that this is the only bit in the package that's not compatible with Python 3 -- no doubt you'll run into further, subtler ones later. So, best is to write the maintainers of xadmin asking what are the plans to make it Py 3-compatible and how you can help w/the task.

提交回复
热议问题