Re: my computer is allergic to pickles

2011-03-11 Thread Bob Fnord
Miki Tebeka wrote: > > >From looking at the shelve info in the library reference, I get > > the impression it's tricky to change the values in the dict for > > existing keys and be sure they get changed on disk. > You can use writeback=True or call sync at the right places. > > > > How can you

Re: my computer is allergic to pickles

2011-03-11 Thread Bob Fnord
Peter Otten <__pete...@web.de> wrote: > Bob Fnord wrote: > > I started by using cPickle to save the instance of the class that > > contained this dict, but the pickling process started to write > > the file but ate so much memory that my computer (4 GB RAM) > > crashed so badly that I had to pres

Re: my computer is allergic to pickles

2011-03-09 Thread Miki Tebeka
> >From looking at the shelve info in the library reference, I get > the impression it's tricky to change the values in the dict for > existing keys and be sure they get changed on disk. You can use writeback=True or call sync at the right places. > How can you convert a tuple of strings to a str

Re: my computer is allergic to pickles

2011-03-09 Thread Peter Otten
Bob Fnord wrote: > I'm using python to do some log file analysis and I need to store > on disk a very large dict with tuples of strings as keys and > lists of strings and numbers as values. > > I started by using cPickle to save the instance of the class that > contained this dict, but the pickli

Re: my computer is allergic to pickles

2011-03-09 Thread Bob Fnord
Terry Reedy wrote: > On 3/7/2011 4:50 AM, Bob Fnord wrote: > > > I want a portable data file (can be moved around the filesystem > > or copied to another machine and used), > > Used only by Python or by other software? just Python > > Would a database in a file have any advantages over a file

Re: my computer is allergic to pickles

2011-03-09 Thread Bob Fnord
"Martin P. Hellwig" wrote: > On 05/03/2011 01:56, Bob Fnord wrote: > > > Any comments, suggestions? > > > No but I have a bunch of pseudo-questions :-) > > What version of python are you using? How about your OS and bitspace > (32/64)? Have you also tried using the non-c pickle module? If the

Re: my computer is allergic to pickles

2011-03-09 Thread Bob Fnord
Miki Tebeka wrote: > > Or, which situations does shelve suit better and which does > > marshal suit better? > shelve ease of use and the fact it uses the disk to store objects makes it a > good choice if you have a lot of object, each with a unique string key (and a > tuple of strings can be co

Re: my computer is allergic to pickles

2011-03-07 Thread Terry Reedy
On 3/7/2011 4:50 AM, Bob Fnord wrote: I want a portable data file (can be moved around the filesystem or copied to another machine and used), Used only by Python or by other software? Would a database in a file have any advantages over a file made by marshal or shelve? If you have read the

Re: my computer is allergic to pickles

2011-03-07 Thread Martin P. Hellwig
On 05/03/2011 01:56, Bob Fnord wrote: Any comments, suggestions? No but I have a bunch of pseudo-questions :-) What version of python are you using? How about your OS and bitspace (32/64)? Have you also tried using the non-c pickle module? If the data is very simple in structure, perhaps s

Re: my computer is allergic to pickles

2011-03-07 Thread Mel
Bob Fnord wrote: > I want a portable data file (can be moved around the filesystem > or copied to another machine and used), so I don't want to use > mysql or postgres. I guess the "sqlite" approach would work, but > I think it would be difficult to turn the tuples of strings and > lists of string

Re: my computer is allergic to pickles

2011-03-07 Thread Bob Fnord
MRAB wrote: > On 05/03/2011 01:56, Bob Fnord wrote: > > I'm using python to do some log file analysis and I need to store > > on disk a very large dict with tuples of strings as keys and > > lists of strings and numbers as values. > > > > I started by using cPickle to save the instance of the cla

Re: my computer is allergic to pickles

2011-03-06 Thread Bob Fnord
GSO wrote: > On 5 March 2011 02:14, MRAB wrote: > ... > >> Any comments, suggestions? > >> > > You obviously can't feed your computer pickles then. > > How about a tasty tidbit of XML? Served up in a main dish of DOM, or > serially if preferred? Well, right now it takes three lines to save t

Re: my computer is allergic to pickles

2011-03-06 Thread Miki Tebeka
> Or, which situations does shelve suit better and which does > marshal suit better? shelve ease of use and the fact it uses the disk to store objects makes it a good choice if you have a lot of object, each with a unique string key (and a tuple of strings can be converted to and from a string).

Re: my computer is allergic to pickles

2011-03-06 Thread Bob Fnord
Miki Tebeka wrote: > > I'm using python to do some log file analysis and I need to store > > on disk a very large dict with tuples of strings as keys and > > lists of strings and numbers as values. > I recommend that you'll use the shelve module. It stores data on disk and is > more memory effic

Re: my computer is allergic to pickles

2011-03-04 Thread Miki Tebeka
> I'm using python to do some log file analysis and I need to store > on disk a very large dict with tuples of strings as keys and > lists of strings and numbers as values. I recommend that you'll use the shelve module. It stores data on disk and is more memory efficient than in-memory pickle obje

Re: my computer is allergic to pickles

2011-03-04 Thread GSO
On 5 March 2011 02:14, MRAB wrote: ... >> Any comments, suggestions? >> You obviously can't feed your computer pickles then. How about a tasty tidbit of XML? Served up in a main dish of DOM, or serially if preferred? -- http://mail.python.org/mailman/listinfo/python-list

Re: my computer is allergic to pickles

2011-03-04 Thread MRAB
On 05/03/2011 01:56, Bob Fnord wrote: I'm using python to do some log file analysis and I need to store on disk a very large dict with tuples of strings as keys and lists of strings and numbers as values. I started by using cPickle to save the instance of the class that contained this dict, but

my computer is allergic to pickles

2011-03-04 Thread Bob Fnord
I'm using python to do some log file analysis and I need to store on disk a very large dict with tuples of strings as keys and lists of strings and numbers as values. I started by using cPickle to save the instance of the class that contained this dict, but the pickling process started to write th