完整的错误信息如下:

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. thinkphp5 redis使用

    参数参考位置:thinkphp\library\think\cache\driver class Redis extends Driver { protected $options = [ 'host ...

  2. mysql捕捉所有SQL语句

    MySQL可以通过开通general_log参数(可动态修改)来扑捉所有在数据库执行的SQL语句.显示参数:mysql> show variables like 'general%log%';+ ...

  3. centos清理缓存

    释放网页缓存(To free pagecache): echo 1 > /proc/sys/vm/drop_caches 释放目录项和索引(To free dentries and inodes ...

  4. dex2jar反编译大文件内存溢出的问题

    @echo off REM better invocation scripts for windows from lanchon, release in public domain. thanks! ...

  5. Asp.Net Core 第05局:读取配置

    前言 本文介绍Asp.Net Core 读取配置文件. 环境 1.Visual Studio 2017 2.Asp.Net Core 2.2 开局 前期准备             1.添加app.j ...

  6. 2644. 数列 (Standard IO)

    这道题是道数论题,如果想对了的话会很快. 因为这道题实在是没有什么知识点,所以我直接上代码,代码上有很详细的注释: #include<iostream> #include<cstdi ...

  7. The Stream of Corning 2( 权值线段树/(树状数组+二分) )

    题意: 有两种操作:1.在[l,r]上插入一条值为val的线段 2.问p位置上值第k小的线段的值(是否存在) 特别的,询问的时候l和p合起来是一个递增序列 1<=l,r<=1e9:1< ...

  8. java 重新学习 (七)

    一.mysql的InnoDB通过建立行级索确保事务完整性.,并以Oracle风格的共享锁来处理select语句.系统默认存储为InnoDB. 二. -- mysql 创建表 CREATE TABLE ...

  9. apache 安装配置 (centos)

    1. 使用yum包安装Apache软件 [root@Apache ~]# yum -y install httpd* [root@Apache ~]# rpm -qa | grep httpd --查 ...

  10. 用swith语句来键入一个整数输出对应是星期几

    基本格式:switch(表达式) { //基本数据类型可以接收byte,short,char,int 引用数据类型可以接收枚举(JDK1.5)String字符串(JDK1.7) case 值1: 语句 ...