完整的错误信息如下:

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

Python sqlite3.ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings......的更多相关文章

  1. python+sqlite3

    一个小例子, # -*- coding:utf-8 -*- ''' Created on 2015年10月8日 (1.1)Python 2.7 Tutorial Pt 12 SQLite - http ...

  2. [Python]sqlite3二进制文件存储问题(BLOB)(You must not use 8-bit bytestrings unless you use a text_factory...)

    事情是这种: 博主尝试用Python的sqlite3数据库存放加密后的usernamepassword信息,表是这种 CREATE TABLE IF NOT EXISTS user ( userID ...

  3. python sqlite3使用

    python sqlite3文档地址:http://docs.python.org/2/library/sqlite3.html The sqlite3 module was written by G ...

  4. python sqlite3 数据库操作

    python sqlite3 数据库操作 SQLite3是python的内置模块,是一款非常小巧的嵌入式开源数据库软件. 1. 导入Python SQLite数据库模块 import sqlite3 ...

  5. python sqlite3 入门 (视频讲座)

    python sqlite3 入门 (视频讲座) an SQLite mini-series! - Simple Databases with Python 播放列表: YouTube https:/ ...

  6. python sqlite3简单操作

    python sqlite3简单操作(原创)import sqlite3class CsqliteTable: def __init__(self): pass def linkSqlite3(sel ...

  7. xls===>csv tables===via python ===> sqlite3.db

    I've got some files which can help a little bit to figure out where people are from based on their I ...

  8. Python sqlite3操作笔记

    创建数据库 def create_tables(dbname): conn = sqlite3.connect(dbname) print "Opened database successf ...

  9. 多线程下,Python Sqlite3报[SQLite objects created in a thread can only be used...]问题

    明明加了锁保护,还是出了下面的问题 ProgrammingError: SQLite objects created in a thread can only be used in that same ...

随机推荐

  1. UPLOADIFY用法

    把下面代码 this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url);  this.settings.but ...

  2. 查看IOS-app证书到期时间

    参照: iOS企业版证书到期 https://www.jianshu.com/p/44b0dc46ef37 如果不能十分确定每一个打出来的ipa的有效期(过期时间),而又需要关注它具体什么时候需要强制 ...

  3. 嵌入式C语言3.4 关键字---类型描述符auto/register/static/const/extern/volatile/

    对内存资源存放位置的限定 1. auto 默认值---分配的内存都是可读可写的区域 auto int a; 区域如果出现 {} 我们认为在栈空间 2. register register int a; ...

  4. python 装饰器 第十步:装饰器来装饰器一个类

    第十步:装饰器来装饰一个类 def kuozhan(cls): print(cls) #声明一个类并且返回 def newHuman(): # 扩展类的功能1 cls.cloth = '漂亮的小裙子' ...

  5. leetcode.排序.451根据字符出现频率排序-Java

    1. 具体题目 给定一个字符串,请将字符串里的字符按照出现的频率降序排列. 示例 1: 输入: "tree" 输出: "eert" 解释: 'e'出现两次,'r ...

  6. ThinkPHP3.2.3 目录介绍

    ThinkPHP3.2.3 目录介绍,在开发中主要操作的目录就是在入口文件www/index.php中定义的www/application/文件目录了. www  WEB部署目录 ├─index.ph ...

  7. 【转】modulenotfounderror: no module named 'matplotlib._path'问题的解决

    今天在装matplotlib包的时候遇到这样的问题,在网上找了很长时间没有类似很好的解决方法,最后自己 研究找到了解决的方法. 之前在pycharm里面已经装了matplotlib包,之后觉着下载包挺 ...

  8. dotNET面试(二)

    值类型与引用类型 1.值类型和引用类型的区别? 值类型包括简单类型.结构体类型和枚举类型,引用类型包括自定义类.数组.接口.委托等. 赋值方式:将一个值类型变量赋给另一个值类型变量时,将复制包含的值. ...

  9. 二、Redis启动、停止、Redis命令行的操作

    1.redis命令 redis执行了make install后,redis的课执行文件都会自动复制到 /usr/local/bin 目录 redis-server redis服务器 redis-cli ...

  10. 网络编程NIO-异步

    异步I/O是没有阻塞地读写数据的方法.通常在代码进行read调用时,代码会阻塞直至可供读取的数据.同样,write调用将会阻塞直至数据能够写入. 1.selector是一个对象,可以注册到很多个cha ...