classification
Title: bsddb can't use unicode keys
Type: enhancement Stage:
Components: Unicode Versions: Python 2.5
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: gregory.p.smith, lemburg, moghe
Priority: normal Keywords:

Created on 2007-08-10 02:32 by moghe, last changed 2007-08-24 03:57 by gregory.p.smith. This issue is now closed.

Files
File name Uploaded Description Edit
bug.txt moghe, 2007-08-10 02:32 python interpreter log
Messages (3)
msg32618 - (view) Author: Erol Aktay (moghe) Date: 2007-08-10 02:32
bsddb throws a TypeError when I try to use an unicode string as key name;
i.e. bsddb.btopen("foobar", "c")[u'foo'] = "bar" fails

I discovered it while experimenting with the shelve module. You may find more information in the attached file.

Python version: 2.5.1
OS: Windows XP SP2 (5.1.2600)
msg55180 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2007-08-23 18:55
Unassigning since I don't know the details of bsddb.
msg55238 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2007-08-24 03:57
The BerkeleyDB library operates on bytes only.  Unicode doesn't make
sense as a key without converting it to a particular encoding first. 
Use the unicode object's encode() method if you need to use it as a
database key or create a wrapper object or subclass of the db that
automatically does that for you as appropriate.
History
Date User Action Args
2007-08-24 03:57:06gregory.p.smithsetstatus: open -> closed
versions: + Python 2.5
nosy: + gregory.p.smith
messages: + msg55238
assignee: gregory.p.smith
resolution: wont fix
2007-08-23 18:55:45lemburgsetassignee: lemburg -> (no value)
messages: + msg55180
2007-08-10 02:32:23moghecreate