On Monday 03 May 2004 21:38, Angus Leeming wrote: > > Incidentally Angus could you verify that it works for you? > > Nope it doesn't. It seems that the problem is here: > > 240 for file in glob.glob("%s*.ppm" % basename): > 241 tmp = mkstemp() > 242 new = t.open(file, "r") > 243 copyfileobj(new, tmp) > 244 if not new.close(): > 245 copyfileobj(tmp, open(file,"wb")) > > It seems that 'new.close()' leaves both 'new' and 'tmp' in a closed > state.
No the problem is the previous copyfileobj call, we need to "rewind" the tmp file to write, after copying from new to tmp the tmp pointer is at the end of file. Just like a tape. ;-) See if the next patch fixes it. > Angus -- José Abílio LyX and docbook, a perfect match. :-)
Index: legacy_lyxpreview2ppm.py =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/scripts/legacy_lyxpreview2ppm.py,v retrieving revision 1.2 diff -u -p -r1.2 legacy_lyxpreview2ppm.py --- legacy_lyxpreview2ppm.py 3 May 2004 13:45:59 -0000 1.2 +++ legacy_lyxpreview2ppm.py 4 May 2004 08:49:27 -0000 @@ -241,7 +241,7 @@ def crop_files(pnmcrop, basename): new = t.open(file, "r") copyfileobj(new, tmp) if not new.close(): - copyfileobj(tmp, open(file,"wb")) + copyfileobj(tmp, open(file,"wb"), 1) def legacy_conversion(argv):