Pytesseract:UnicodeDecodeError:' charmap'编解码器不能解码字节

时间:2015-10-03 21:24:06

标签: python-3.x tesseract python-unicode python-tesseract

我在Pytesseract的屏幕截图上运行了大量的OCR。这在大多数情况下运行良好,但是少数导致此错误:

var mongoose = require('mongoose'),
    mongooseDelete = require('mongoose-delete'),
    Schema = mongoose.Schema;

var MySchema = new Schema({
  name: {type: String, required: true}
});

MySchema.plugin(mongooseDelete, {deletedAt: true, deletedBy: true});

MySchema.pre('find', function (next){
  // I want to add {deleted: false} to the queries conditions
});

我正在使用Python 3.4。任何建议我如何防止这种错误发生(除了一个尝试/除外)将是非常有帮助的。

1 个答案:

答案 0 :(得分:0)

确保使用正确的解码选项 见https://docs.python.org/3/library/codecs.html#standard-encodings

str.decode(' UTF-8')
bytes.decode(' cp950')繁体中文等