Re: Problem with zipfile and newlines

2008-03-11 Thread neilcrighton
I think I've worked it out after reading the 'Binary mode for files' section of http://zephyrfalcon.org/labs/python_pitfalls.html zipfile extracts as file as a binary series of characters, and I'm writing out this binary file as a text file with open('foo','w'). Normally Python converts a '\n' in

Re: Problem with zipfile and newlines

2008-03-11 Thread neilcrighton
Sorry my initial post was muddled. Let me try again. I've got a zipped archive that I can extract files from with my standard archive unzipping program, 7-zip. I'd like to extract the files in python via the zipfile module. However, when I extract the file from the archive with ZipFile.read(), it

Re: Problem with zipfile and newlines

2008-03-10 Thread John Machin
On Mar 10, 11:14 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > "Neil Crighton" <[EMAIL PROTECTED]> wrote: > > I'm using the zipfile library to read a zip file in Windows, and it > > seems to be adding too many newlines to extracted files. I've found > > that for extracted text-encoded files, removi

Re: Problem with zipfile and newlines

2008-03-10 Thread Duncan Booth
"Neil Crighton" <[EMAIL PROTECTED]> wrote: > I'm using the zipfile library to read a zip file in Windows, and it > seems to be adding too many newlines to extracted files. I've found > that for extracted text-encoded files, removing all instances of '\r' > in the extracted file seems to fix the pr

Re: Problem with zipfile and newlines

2008-03-10 Thread John Machin
On Mar 10, 8:31 pm, "Neil Crighton" <[EMAIL PROTECTED]> wrote: > I'm using the zipfile library to read a zip file in Windows, and it > seems to be adding too many newlines to extracted files. I've found > that for extracted text-encoded files, removing all instances of '\r' > in the extracted file

Problem with zipfile and newlines

2008-03-10 Thread Neil Crighton
I'm using the zipfile library to read a zip file in Windows, and it seems to be adding too many newlines to extracted files. I've found that for extracted text-encoded files, removing all instances of '\r' in the extracted file seems to fix the problem, but I can't find an easy solution for binary