ImportCSV and Salstat almost finished!

Released: Sat, 12 Apr 2014 21:15:00 +0000

A new routine to parse single lines of CSV was done from scratch to ensure that key characters (quotes and delimiters) within quotes are handled well. This was a weak point of the previous code and it works well now. This code is thickly commented just in case there's a bug in it and I need to understand it again. It's not that complicated but the flow has to go in a particular order for a reason.

I'm also sure that there are cooler ways to code the ParseLine method but this way is simpler to understand for future users, and easier to debug. And yes, it handles multiple delimiters, multiple text delimiters characters, and all sorts within quotation marks. 

The cancel buttons on the UI work as intended; there is a proper Salstat icon on the file open dialog (for systems that use it); loaded CSV data now sets the unsaved data flag; the dialog begins with sensible defaults.

So far, it's been a productive time with what feels like a really useful bit of software being made. And it should be adaptable to a range of other softwares because it's easy to integrate with almost anything (it only needs a wx.Frame instance and the base directory for the file dialog to be sent as parameters to return all the necessary data.

Fixed-width files are the Cinderella still. Nothing's been done on these. Once they're done, this work might be finished bar debugging. 


Code is at GitHub here: https://github.com/salmoni/Salstat/blob/master/ImportCSV.py and there's a Gist with some gnarly test data https://gist.github.com/salmoni/10556194. Feel free to dive in and test.



Contact us:

We're happy to hear from you

Email us
Contact form

Salstat's social world:





Salstat is an open source project fostered by Thought Into Design Ltd
Thought Into Design Ltd is registered in England and Wales (Companies House number 7367421)