完整的错误信息如下:

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. pip install 报SSL异常和timeout异常

    在安装pip3 install virtualenv时报了SSL异常 如图 pip is configured with locations that require TLS/SSL, however ...

  2. 加载的DAL数据访问层的类型

    using System; using System.Collections; using System.Reflection; using CSFrameworkV4_5.Core; using C ...

  3. Linux下实现MySQL数据库每天定时自动备份

    使用MySQL自带的备份工具+ crontab 的方式来实现备份 1.查看磁盘挂载信息(选一个容量合适的) #df -h 2.创建备份目录 为了方便,在/home保存备份文件: cd /home/ga ...

  4. The life-saving straw

    English learning   In contemporary world, English learning has gained great popularity and it is of ...

  5. smartforms 字段文本碰见 "-" 自动换行

    长文本会在 '-' 这个符号处自动换行 原理:SAP 标准SMARTFORMS 的功能,遇到 '-' 自动判断后面字段是否能在本行完全显示,不够则换行 注意:如果一行文本有多个 ‘-’ ,则 判断 ' ...

  6. 解惑结构体与结构体指针(struct与typedef struct在数据结构的第一道坎)

    /* 数据结构解惑01  在数据结构中会看到 typedef struct QNode { QElemType data; //数据域 struct QNode *next; //指针域 }QNode ...

  7. 恐怖的奴隶主(bob)

    题目描述 小L热衷于undercards. 在undercards中,有四个格子.每个格子要么是空的,要么住着一只BigBob. 每个BigBob有一个不超过k的血量:血量减到0视为死亡.那个格子随即 ...

  8. Linux.中断处理.入口x86平台entry_32.S

    Linux.中断处理.入口x86平台entry_32.S Linux.中断处理.入口x86平台entry_32.S 在保护模式下处理器是通过中断号和IDTR找到中断处理程序的入口地址的.IDTR存的是 ...

  9. java虚拟机规范(se8)——java虚拟机的编译(三)

    3.6 接受参数 如果n个参数传给一个实例的方法,按照约定,它们被接受并放在这个新方法创建的栈帧中的局部变量表里,在局部变量表中的序号从1到n.这些参数按照它们传递过来的顺序存放.例如: int ad ...

  10. python 图像的离散傅立叶变换

    图像(MxN)的二维离散傅立叶变换可以将图像由空间域变换到频域中去,空间域中用x,y来表示空间坐标,频域由u,v来表示频率,二维离散傅立叶变换的公式如下: 在python中,numpy库的fft模块有 ...