Jet Database (DAO3.6), win32com, dbByte field
Christos TZOTZIOY Georgiou
DLNXPEGFQVEB at spammotel.com
Fri Jan 17 15:20:15 EST 2003
I am trying to update a database of a friend of mine with some MD5 sums
for the files he has in archival CD's... So, in his FileInfo table, I
did the following:
>>> td = db.TableDefs("FileInfo")
>>> f =tn.CreateField("md5sum", comclt.constants.dbByte, 16)
>>> tn.Fields.Append(f)
I thought the Byte type was the type needed. I closed the database, and
opened it from his Access 2000, and the field was there, and I could
update it just like a string. So I tried again from Python:
(after opening the database again)
>>> rs=db.OpenRecordset("test", comclt.constants.dbOpenTable)
>>> rs.Edit()
>>> rs.Fields("md5sum").Value= "hello there"
(I didn't bother calculating a sum here, it was a test)
and I got the following error:
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File
"C:\Pyth.22\win32com\gen_py\00025E01-0000-0000-C000-000000000046x0x5x0.py",
line 2160, in __setattr__
d.__setattr__(attr, value)
File "C:\Pyth.22\win32com\client\__init__.py", line 357, in
__setattr__
apply(self._oleobj_.Invoke, args + (value,) + defArgs)
com_error: (-2147352567, 'Exception occurred.', (0, 'DAO.Field', 'Data
type conversion error.', 'j', 5003421, -2146824867), None)
It seems to me it is a matter of Unicode conversion (since all COM I/O
is through Unicode); the byte field gets Unicode data and so it bails
out.
Unfortunately googling c.l.py I didn't manage to find anything
relevant...
How can I do that? Can I use an arbitrary byte sequence to fill this
field?
TIA for any info.
--
TZOTZIOY, I speak England very best,
Real email address: 'dHpvdEBzaWwtdGVjLmdy\n'.decode('base64')
More information about the Python-list
mailing list