Re: Working with fixed format text db's

2007-06-09 Thread Lloyd Zusman
Frank Millman <[EMAIL PROTECTED]> writes: > On Jun 8, 5:50 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: >> Many of the file formats I have to work with are so-called >> fixed-format records, where every line in the file is a record, >> and every field in a record takes up a specific amount of space

Re: Working with fixed format text db's

2007-06-09 Thread John Machin
On Jun 9, 5:48 am, Mark Carter <[EMAIL PROTECTED]> wrote: > Neil Cerutti wrote: > > The underlying problem, of course, is the archaic flat-file > > format with fixed-width data fields. Even the Department of > > Education has moved on to XML for most of it's data files, > > :( > > I'm writing a sma

Re: Working with fixed format text db's

2007-06-09 Thread Frank Millman
On Jun 8, 5:50 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: > Many of the file formats I have to work with are so-called > fixed-format records, where every line in the file is a record, > and every field in a record takes up a specific amount of space. > > For example, one of my older Python progra

Re: Working with fixed format text db's

2007-06-08 Thread [EMAIL PROTECTED]
On Jun 8, 6:18?pm, Ben Finney <[EMAIL PROTECTED]> wrote: > Neil Cerutti <[EMAIL PROTECTED]> writes: > > I was hoping for a module that provides a way for me to specify a > > fixed file format, along with some sort of interface for writing and > > reading files that are in said format. > > Isn't tha

Re: Working with fixed format text db's

2007-06-08 Thread Frank Swarbrick
Neil Cerutti wrote: > The underlying problem, of course, is the archaic flat-file > format with fixed-width data fields. Even the Department of > Education has moved on to XML for most of it's data files, which > are much simpler for me to parse. XML easier to parse than fixed position file. Wow!

Re: Working with fixed format text db's

2007-06-08 Thread John Machin
On Jun 9, 7:55 am, Jeremy C B Nicoll <[EMAIL PROTECTED]> wrote: > Neil Cerutti <[EMAIL PROTECTED]> wrote: > > On 2007-06-08, Jeremy C B Nicoll <[EMAIL PROTECTED]> wrote: > > > Neil Cerutti <[EMAIL PROTECTED]> wrote: > > >> Luckily, the output format has not changed yet, so issues with > > >> mainta

Re: Working with fixed format text db's

2007-06-08 Thread Jeremy C B Nicoll
Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-06-08, Jeremy C B Nicoll <[EMAIL PROTECTED]> wrote: > > Neil Cerutti <[EMAIL PROTECTED]> wrote: > >> Luckily, the output format has not changed yet, so issues with > >> maintaining the above haven't arisen. > > > > The problem surely is that when y

Re: Working with fixed format text db's

2007-06-08 Thread Ben Finney
Neil Cerutti <[EMAIL PROTECTED]> writes: > I was hoping for a module that provides a way for me to specify a > fixed file format, along with some sort of interface for writing and > reading files that are in said format. Isn't that done by the 'struct' module http://www.python.org/doc/lib/module-

Re: Working with fixed format text db's

2007-06-08 Thread Mark Carter
Neil Cerutti wrote: > The underlying problem, of course, is the archaic flat-file > format with fixed-width data fields. Even the Department of > Education has moved on to XML for most of it's data files, :( I'm writing a small app, and was wondering the best way to store data. Currently the fi

Re: Working with fixed format text db's

2007-06-08 Thread Neil Cerutti
On 2007-06-08, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, Neil Cerutti wrote: > >> new = file("new.dat", "w") >> if not new: >> print "Error. Could not open file new.dat for writing." >> raw_input("Press Return To Exit.") >> sys.exit(1) > > Hey, Python

Re: Working with fixed format text db's

2007-06-08 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Neil Cerutti wrote: > new = file("new.dat", "w") > if not new: > print "Error. Could not open file new.dat for writing." > raw_input("Press Return To Exit.") > sys.exit(1) Hey, Python is not C. File objects should *always* be "true". An error is handled via e

Re: Working with fixed format text db's

2007-06-08 Thread Neil Cerutti
On 2007-06-08, Jeremy C B Nicoll <[EMAIL PROTECTED]> wrote: > Neil Cerutti <[EMAIL PROTECTED]> wrote: >> Luckily, the output format has not changed yet, so issues with >> maintaining the above haven't arisen. > > The problem surely is that when you want to change the format > you have to do so in a

Re: Working with fixed format text db's

2007-06-08 Thread Jeremy C B Nicoll
Neil Cerutti <[EMAIL PROTECTED]> wrote: > Luckily, the output format has not changed yet, so issues with > maintaining the above haven't arisen. The problem surely is that when you want to change the format you have to do so in all files (and what about the backups then?) and all programs simulta