完整的错误信息如下:

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. 8051 r0-r7 是什么

    R0~R7表示当前选中的寄存器组的寄存器0~7,5I机有p0,p1,p2,p3口,每组有八个寄存器(R0-R7),比如MOV A Rn (n=0~7),表示把寄存器Rn 的内容送给累加器A,其中源操作 ...

  2. (一)arm交叉编译工具链准备

    1.背景 arm机器一般因为资源问题进行编译会影响开发速度,而且很多时候因为资源不够而无法完成编译工作.因此,需要在执行机上进行交叉编译,即使用x86或其他架构机器基于交叉编译工具编译出在arm上可以 ...

  3. xcodebuild自动打包上传到蒲公英的shell脚本

    注意: ExportOptions.plist (包含了证书相关信息) 该plist 文件可以通过xcode手动导出ipa之后获取到, 区分appstore 和 development的情况 #! / ...

  4. 2.tensorflow——Softmax回归

    import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.examples. ...

  5. C# 几进制 转换到几进制

    public string ConvertString(string value, int fromBase, int toBase) { int intValue = Convert.ToInt32 ...

  6. java中的fail-fast(快速失败)机制

    java中的fail-fast(快速失败)机制 简介 fail-fast机制,即快速失败机制,是java集合中的一种错误检测机制.当在迭代集合的过程中对该集合的结构改变是,就有可能会发生fail-fa ...

  7. 实用js片段

    算法 //加法 add(10,2) //12 function add(a, b) { var c, d, e; try { c = a.toString().split(".") ...

  8. Codeforces 492B Name That Tune ( 期望DP )

    B. Name That Tune time limit per test 1 second memory limit per test 256 megabytes input standard in ...

  9. 【问题解决方案】单个文件夹嵌套时github仓库中最外层文件夹直接显示所有嵌套文件夹名的问题

    上传文件的时候遇到这样一个问题: 这么看着好像有什么问题,直觉不应该这么显示吧 折腾半天,从github新建了嵌套文件夹并同步到本地,然后从本地push了文件,结果依然显示是这样 好吧,那这个问题应该 ...

  10. kubernetes容器集群部署Flannel网络

    Overlay Network:覆盖网络,在基础网络上叠加的一种虚拟网络技术模式,该网络中的主机通过虚拟链路连接起来. VXLAN:将源数据包封装到UDP中,并使用基础网络的IP/MAC作为外层报文头 ...