From: <bc...@wo...> - 2001-09-04 19:21:56
|
[Robert W. Bill] >Hello Chris, > >Probably not pickle, but PyFile. Even without pickle, the following file >is empty: > >open('junk.txt', 'w').write('This is a test') > >Currently, an explicit close() or flush() is required on the file. e.g. > >f = open('junkpickle.txt', 'w') >pickle.dump(range(10), f) >f.close() # or flush() > >This makes the following usage a bad idea <g> > >pickle.dump(range(10), open("pickle.txt", "w")) > >Yes, this was not required in 2.0, but this is the scoop since 2.1a1. >Unfortuately, a search on PyFile in the checkins list doesn't return >any hits (crummy Geocrawler). However, The diff between the 2.0 and 2.1a1 >PyFile is sizable. I don't know if this change in autoflushing is >intentional or not. It is not intentional, but a result of the buffering (which give us a sizable performance boost, especially for pickle) and the fact that PyFiles isn't closed when exiting. >It's worthy of a FAQ entry or a patch depending on the >answer to that. Probably both, because I don't think we can fix this problem for all versions of java. regards, finn |