
BUG
文章平均质量分 73
鼻涕虫de皮皮
这个作者很懒,什么都没留下…
展开
-
Python DeprecationWarning 类型错误
升级pymongo模块到3.x的时候,产生了下面警告:DeprecationWarning: update is deprecated. Use replace_one, update_one or update_many instead.然后看了pymongo.collection.Collection.update方法def update(self, spec, document, ups原创 2015-09-29 18:17:21 · 34340 阅读 · 0 评论 -
Python subprocess注意问题
最近写了个脚本,需要执行第三方程序,并根据程序输出判断执行情况,当程序执行时间过长时kill该进程。因此选用了subprocess模块。process = subprocess.Popen(self.cmd,stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell=True ,close原创 2015-08-27 09:52:47 · 2989 阅读 · 0 评论 -
PicklingError: Can't pickle <type 'thread.lock'>: attribute lookup thread.lock failed
错误原因:使用队列错误(Queue.Queue()不能用于进程间通信)当子进程执行的方法定义在类中时会报错:PicklingError: Can't pickle : attribute lookup __builtin__.instancemethod faileddef main(): manager = multiprocessing.Manager() queue =原创 2015-07-31 17:50:34 · 6162 阅读 · 0 评论 -
python recv在连接断开后会变为非阻塞
以前一直以为recv默认是一直阻塞的。后来发现并不是这样。recv默认是阻塞的,当然也可以使用s.setblocking()或者s.settimeout()。Python socket:http://www.hiadmin.org/code/python-socket-tcp/comment-page-1但是当客户端断开连接后recv就会变为非阻塞,并返回空的字符串#cod原创 2015-07-28 10:54:54 · 5694 阅读 · 0 评论 -
DocumentTooLarge: BSON document too large:
找段错误的BUG的时候发现迭代mongo cursor的时候产生了这个异常:DocumentTooLarge: BSON document too large (108549088 bytes) - the connected serversupports BSON document sizes up to 16777216 bytes.Mongodb的单个文档的BSON size不能原创 2015-11-12 14:40:54 · 4534 阅读 · 1 评论 -
pymongo异常-OperationFailure: command SON(...)
File "C:\Python27\lib\site-packages\pymongo\mongo_client.py", line 397, in _cache_credentials sock_info.authenticate(credentials) File "C:\Python27\lib\site-packages\pymongo\pool.py", line 287,原创 2015-11-23 17:13:20 · 5573 阅读 · 0 评论