zoukankan      html  css  js  c++  java
  • Python sqlite3.ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings......

    完整的错误信息如下:

    You must not use 8-bit bytestrings unless you use a text _factory that can interpret 8-bit bytestrings (like text_factory = str).
    It is highly recomme nded that you instead just switch your application to Unicode strings.

    原因:

    使用sqlite3数据库,对数据库进行操作的过程中,使用没有经过unicode解码的中文数据导致的。

    举例:
    category = Category.query.filter( Category.name == "上衣").first()
    会报上述错误。
     
    解决方案:
    需要对中文进行unicode解码:
    category = Category.query.filter( Category.name == u"上衣").first()
     
    作者:yaoelvon@gmail.com
    时间:2016/03/31
  • 相关阅读:
    长宽广州地区DNS
    修改PHP的memory_limit限制
    适用于Magento的最合适的.htaccess写法
    在magento中如何回复客户的评论
    冲刺!
    冲刺!
    冲刺!
    冲刺!
    冲刺!
    冲刺!
  • 原文地址:https://www.cnblogs.com/yaoel/p/5342322.html
Copyright © 2011-2022 走看看