更新couchdb文档时获取quote_from_bytes()预期的字节数

时间:2017-05-06 07:12:01

标签: python couchdb

我正在尝试更新现有文档,并且我一直收到typeError(quote_from_bytes()期望字节)

我的代码:

couch = couchdb.Server("<http>")
couch.resource.credentials = ("USERNAME","PASSWORD")
db = couch['mydb']

id = "183848484"
doc = db[id]

"""doing some operations on data here"""

db[id] = doc

我的错误日志:

  

self.db [self.docID] = doc文件   “/home/sunilgopikrishna/.local/lib/python3.5/site-packages/couchdb/client.py”   第427行, setitem       resource = _doc_resource(self.resource,id)文件“/home/sunilgopikrishna/.local/lib/python3.5/site-packages/couchdb/client.py”,   第1057行,在_doc_resource中       return base(doc_id)File“/home/sunilgopikrishna/.local/lib/python3.5/site-packages/couchdb/http.py”,   第537行,致电       obj = type(self)(urljoin(self.url,* path),self.session)文件“/home/sunilgopikrishna/.local/lib/python3.5/site-packages/couchdb/http.py”,   第678行,在urljoin       路径= '/'。加入([ ''] + [在路径引用(个),S])文件 “/home/sunilgopikrishna/.local/lib/python3.5/site-packages/couchdb/http.py” ,   678行       路径= '/'。加入([ ''] + [在路径引用(个),S])文件 “/home/sunilgopikrishna/.local/lib/python3.5/site-packages/couchdb/http.py” ,   第630行,引用       return util.urlquote(string,safe)文件“/usr/lib/python3.5/urllib/parse.py”,第712行,引用       return quote_from_bytes(string,safe)文件“/usr/lib/python3.5/urllib/parse.py”,第737行,在quote_from_bytes       提出TypeError(“quote_from_bytes()期望字节”)TypeError:quote_from_bytes()期望字节

感谢。

1 个答案:

答案 0 :(得分:0)

编码错误(我错过了')