Hi all,
I was talking to Kevin Altis the other night and he mentioned that there is
apparently some need for a CSV (comma separated values) file importer for
some part of PythonCard. If you are working on this you might consider a
module I wrote some time ago:
www.sf.net/projects/python-dsv
DSV stands for "delimiter separated values" (since it's not limited to
commas). I wrote it (entirely in Python) to be compatible with the files
used by MS Excel, however, it is also unique in that it provides some
additional features I've not seen in other CSV importers:
- Can guess the format of the file (what delimiter is used, what
text-qualifier
is used and whether the first row is a header row).
- Correctly parses embedded newlines and quotes
- Provides a wxPython dialog for previewing the data and changing the
guessed
parameters (similar to the one in MS Excel).
- Pluggable error handling functions (e.g. discard invalid rows, keep them,
log them, etc)
- It's faster than you might expect ;-)
The heuristics are optional (you can provide explicit values) as is the GUI
portion.
Anyway, it's been a while since I actually used it, but I tested it prior
to posting it on SF (around 2 months ago) and it seemed to work fine. This
code was used in a production environment for some time and worked without
fail on fairly large files (50k-300k lines, 20+ columns).
If you do decide to use it and encounter any problems, please contact me
and I'll be glad to help.
Regards,
--
Cliff Wells
Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308
(800) 735-0555 x308
|