bson.errors.InvalidStringData: strings in documents must be valid UTF-8
场景:
pymongo 查询数据库的时候报错。
for gscode in GSList_StockPool_Mongo_MktStop:
self._collection_flash.find({"ymd": nDateNow, "gscode": gscode}).count()
原因:
不是utf-8编码,gscode 取到的中文是乱码。
解决方法:
编码改为utf-8。
bson.errors.InvalidStringData: strings in documents must be valid UTF-8的更多相关文章
- python unicode字节串转成中文问题
如题,其实我的问题很简单,就是在写爬虫的时候拿到网页的信息包含类似“\u65b0\u6d6a\u5fae\u535a\u6ce8\u518c”的字符串,实际上这是unicode的中文编码,对应的中文为 ...
- MongoDB - Introduction to MongoDB, Documents
MongoDB stores data records as BSON documents. BSON is a binary representation of JSON documents, th ...
- abiword Related Pages
Application Framework The 'af' directory contains all source code for the cross-platform application ...
- go语言操作mongodb
Install the MongoDB Go Driver The MongoDB Go Driver is made up of several packages. If you are just ...
- nosql_action
ps -aux 查当前端口占用 connecting to: test > show dbs local .078125GB testphp .203125GB > use testph ...
- Python2.7.6标准库内建函数
Built-in Functions abs() divmod() input() open() staticmethod() all() enumerate() int() ord( ...
- 【GoLang】GO语言系列--002.GO语言基础
002.GO语言基础 1 参考资料 1.1 http://www.cnblogs.com/vimsk/archive/2012/11/03/2736179.html 1.2 https://githu ...
- ExtJS4笔记 Data
The data package is what loads and saves all of the data in your application and consists of 41 clas ...
- andriod 开发记录apidemos 错误解决
android sdk 里面有simple 文件夹里面有对应的demo 但是拿出来esplise运行报错 解决方案如下 右键错误代码goto,给对应错误的单引号前加 \ 原文http://stack ...
随机推荐
- 软件测试自动化之- API Test
API测试 从本质上来说,API测试是用来验证组成软件的那些单个方法的正确性,而不是测试整个系统本身. API测试也被称为单元测试(Unit Testing), 模块测试(Module Testing ...
- @RequestBody 处理类型 和 对象 和 json 相互转换
1 @RequestBody 处理类型 在项目中经常看到controller 中有 @RequestBody 字样,他到底有什么作用? 一般使用表单提交数据时不需要使用@RequestBody 即可自 ...
- oracle ORA-00119和ORA-00132解决方法
ORA-00119 ORA-00132解决方法. 思路:*.local_listener错误导致.要*.local_listener就要修改spfile文件,因为oracle默认是以spfile文件启 ...
- macbook中gcc替换为gnu gcc
macbook中gcc被定义为clang,而正统的gnu gcc却只能使用gcc-7(gcc 7版本),然而,如果修改/usr/bin的链接,还容易造成系统错误,因为mac的工具链和gcc(clang ...
- iptables的地址取反操作
感叹号要写在-d的前面才行,而且要用空格隔开. iptables -A OUTPUT -o eth0 -p tcp ! -d xxx.xxx.xxx.xxx -j DROP
- PCIE的DMA和PIO介绍
墨尘 百家号01-2422:14 在PCIE中有两种数据传输方式: DMA(Direct Memory Access),直接内存访问,在该模式下,数据传送不是由CPU负责处理,而是由一个特殊的处理器D ...
- [MySQL] MySQL中关于外键报错的解决和建议
一.缘由 今天在恢复从库和主库不同步的数据时,看到关于外键的报错. ERROR 1451 (23000): Connot delete or update a parent row: a foreig ...
- #pragma GCC system_header用法
在看公司公共库的头文件中发现了:#pragma GCC system_header一行,以前没有见过这种用法,在网上查了一下,解释如下: 从#pragma GCC system_header直到文件结 ...
- Centos7 squid安装与配置
装squid yum install -y squid 安装httpd(用于后面生成密码文件) yum install -y httpd 或者 yum install httpd-tools -y 配 ...
- css3实现立方体效果
<!DOCTYPE html><html><head><meta charset="utf-8" /><title>&l ...