A Dilluns 24 Abril 2006 20:01, Stephen Simmons va escriure:
> Hi,
>
> I have a problem with using PyTables 1.3 to store strings in a StringCol
> column of length 1.
> Whenever the string is "", table.append(rows) gives a ValueError exception.
> These exceptions only appear for StringCols of length 1; everything is
> fine if the length is 2 or higher.
>
> This seems to be a consequence of how numarray pads/strips CharArray
> strings.
> Does anyone have any suggestions for a work-around?
> At the moment, my best idea is to save str+'\x00'.
Well, this turns out to be a typo in numarray. You can apply the patch
below for a cure. I've reported this to numarray mantainers.
--- numarray/records.py.orig 2006-02-03 19:28:57.000000000 +0100
+++ numarray/records.py 2006-04-25 20:04:02.000000000 +0200
@@ -192,7 +192,7 @@
try:
a = arrayList[i]
if (isinstance(a, chararray.RawCharArray) and a._itemsize == 0):
- a = "\0x0"
+ a = "\x00"
_array.field(_array._names[i])[:] = a
except TypeError: # trap only TypeError to get better messages
raise TypeError, "Incorrect format %s, copy unsuccessful." %
_array._formats[i]
Regards,
--
>0,0< Francesc Altet http://www.carabos.com/
V V Cárabos Coop. V. Enjoy Data
"-"
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Pytables-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pytables-users