[Metakit] Python & Unicode

Atamert Ölçgen muhuk at muhuk.com
Fri Mar 10 21:15:28 CET 2006


Thanks for the reply. Type S gives "not a python string", type B gives 
"wrong type for ByteProp". Here is the output:

 >>> db = metakit.storage("test.db", 2)
 >>> v = db.getas("test[name:B,test:S]")
 >>> v.append(name='abc',test='def')
0
 >>> for row in v: print row.name, row.test
...
abc def
 >>> v.append(name=u'abc',test='def')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: wrong type for ByteProp
 >>> v.append(name='abc',test=u'def')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: not a Python string


metakit at kaishaku.org wrote On 10-03-2006 16:55:
>> Is is possible to use python unicode strings with metakit? When I try to 
>> pass u'aaa' it raises "TypeError: not a Python string". If Mk4py has no 
>> python unicode support, is there an easy way to automatically convert to 
>> uft8 (it seems to work ok).
>> I read the documentation and did some search on list archives and it 
>> seemed that there is unicode support.
>> By the way Metakit rocks.
>> Best regards,
>> Atamert
>>     
>
> It seems to me you need to use the B data type, not S.
>
> The documentation does state you should use S for strings
> particularly because of future unicode changes, but I guess
> those changes have not been made or have not made their way
> through to the Python wrapper.
>
> The C++ header files still indicate char* is used for all
> the data type S (string) functions/methods. *shrug*
>
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.equi4.com/pipermail/metakit/attachments/20060310/8ff29599/attachment.htm


More information about the Metakit mailing list