Re: Adding new lines to word document using zipfile module within python 2.7?

2013-08-27 Thread Christian Gollwitzer
Am 27.08.13 22:45, schrieb accessnew...@gmail.com: Writing text to a word document (word 2007) using the zipfile module via python coding (python 2.7). Below if the section of code I am using to do this. I can't figure out what character I need to use to get it to add new lines to the zi

Adding new lines to word document using zipfile module within python 2.7?

2013-08-27 Thread accessnewbie
Writing text to a word document (word 2007) using the zipfile module via python coding (python 2.7). Below if the section of code I am using to do this. I can't figure out what character I need to use to get it to add new lines to the zipfile. if Count: blurb = "\r\nINSERT TABLE

Re: Zipfile module errors

2008-06-04 Thread John Machin
jwesonga wrote: I've added the line to the script, added a zipped file into the folder. I've made sure the file exists. The error is now this: Please get some clues: (1) Don't reply off-list unless specifically invited. (2) Don't top-post. (3) Do read and try to understand *all* of each reply t

Re: Zipfile module errors

2008-06-04 Thread John Machin
On Jun 4, 8:06 pm, jwesonga <[EMAIL PROTECTED]> wrote: > Hi, > > I have a python script that supposed to go through a folder, pick the > zipped files, unzip them and process the data inside. I'm not sure > where i'm going wrong with this script because it all seems correct: Nothing is ever as it s

Zipfile module errors

2008-06-04 Thread jwesonga
Hi, I have a python script that supposed to go through a folder, pick the zipped files, unzip them and process the data inside. I'm not sure where i'm going wrong with this script because it all seems correct: #! /usr/bin/env python import zipfile import os from elementtree import ElementTree as

Re: zipfile [module and file format, both] stupidly broken

2007-05-21 Thread Jorgen Grahn
On Sat, 19 May 2007 17:00:01 + (UTC), Martin Maney <[EMAIL PROTECTED]> wrote: ... > posted here and had so much fun. Apparently I don't speak for most readers here, but I had fun too. Smart, reasonable people write braindead code all the time. I think it's fine when people whine about that o

Re: zipfile [module and file format, both] stupidly broken

2007-05-20 Thread Thorsten Kampe
* Paul Boddie (20 May 2007 08:36:18 -0700) > Thorsten Kampe wrote: > > Don't be silly. Where would you look for the URL to report bugs? On > > the website of the project, of course. It's not that easy to find on > > python.org (although not as hard as Martin says): > > > > Core Development > Links

Re: zipfile [module and file format, both] stupidly broken

2007-05-20 Thread Paul Boddie
Thorsten Kampe wrote: > > Don't be silly. Where would you look for the URL to report bugs? On > the website of the project, of course. It's not that easy to find on > python.org (although not as hard as Martin says): > > Core Development > Links for Developers > Bug Manager or This is the "in crow

Re: zipfile [module and file format, both] stupidly broken

2007-05-20 Thread Thorsten Kampe
* Gabriel Genellina (Sat, 19 May 2007 18:09:06 -0300) > En Sat, 19 May 2007 14:00:01 -0300, Martin Maney <[EMAIL PROTECTED]> > escribió: > > BTW, thanks for the pointer someone else gave to the proper place for > > posting bugs. I'd had the silly idea that I would be able to find that > > easily

Re: zipfile [module and file format, both] stupidly broken

2007-05-19 Thread Martin Maney
Gabriel Genellina <[EMAIL PROTECTED]> wrote: > A module in the Python Standard Library has a bug. I take the Python > Library Reference manual, go to the last pages (Appendix B), and find how > to properly report a bug. Sure, the information is *somewhere*. Silly me, I expected it to be readi

Re: zipfile [module and file format, both] stupidly broken

2007-05-19 Thread Gabriel Genellina
En Sat, 19 May 2007 14:00:01 -0300, Martin Maney <[EMAIL PROTECTED]> escribió: > BTW, thanks for the pointer someone else gave to the proper place for > posting bugs. I'd had the silly idea that I would be able to find that > easily at www.python.org, but if I had then I'd not have posted here

Re: zipfile [module and file format, both] stupidly broken

2007-05-19 Thread Martin Maney
Larry Bates <[EMAIL PROTECTED]> bristled: > Are you serious? A zipfile with a comment > 4Kbytes. I've never encountered > such a beast. If I hadn't run into one I would never have had a clue that Python's zipfile module had this silly bug. > As with any open so

Re: Could zipfile module process the zip data in memory?

2007-04-29 Thread John Machin
without saving it into file. > > > > In the document of the zipfile module, I note that it mentions the > > > > file-like object? what does it mean? > > > > > class ZipFile( file[, mode[, compression[, allowZip64]]]) > > > > Open a ZIP file

Re: Could zipfile module process the zip data in memory?

2007-04-29 Thread John Machin
ariable. how could I process the > > > zipfile directly without saving it into file. > > > In the document of the zipfile module, I note that it mentions the > > > file-like object? what does it mean? > > > > class ZipFile( file[, mode[, compression[, allowZ

Re: Could zipfile module process the zip data in memory?

2007-04-29 Thread 人言落日是天涯,望极天涯不见家
hout saving it into file. > > > > In the document of the zipfile module, I note that it mentions the > > > > file-like object? what does it mean? > > > > > class ZipFile( file[, mode[, compression[, allowZip64]]]) > > > >          Open a ZIP file

Re: Could zipfile module process the zip data in memory?

2007-04-29 Thread 人言落日是天涯,望极天涯不见家
On Apr 29, 7:37 pm, "Daniel Nogradi" <[EMAIL PROTECTED]> wrote: > > I made a C/S network program, the client receive the zip file from the > > server, and read the data into a variable. how could I process the > > zipfile directly without saving it into file.

Re: Could zipfile module process the zip data in memory?

2007-04-29 Thread Diez B. Roggisch
rectly without saving it into file. >>> In the document of the zipfile module, I note that it mentions the >>> file-like object? what does it mean? >>> class ZipFile( file[, mode[, compression[, allowZip64]]]) >>> Open a ZIP file, where file can be eith

Re: Could zipfile module process the zip data in memory?

2007-04-29 Thread Daniel Nogradi
> > > I made a C/S network program, the client receive the zip file from the > > > server, and read the data into a variable. how could I process the > > > zipfile directly without saving it into file. > > > In the document of the zipfile module, I note that it

Re: Could zipfile module process the zip data in memory?

2007-04-29 Thread 人言落日是天涯,望极天涯不见家
On Apr 29, 7:37 pm, "Daniel Nogradi" <[EMAIL PROTECTED]> wrote: > > I made a C/S network program, the client receive the zip file from the > > server, and read the data into a variable. how could I process the > > zipfile directly without saving it into file.

Re: Could zipfile module process the zip data in memory?

2007-04-29 Thread Daniel Nogradi
> I made a C/S network program, the client receive the zip file from the > server, and read the data into a variable. how could I process the > zipfile directly without saving it into file. > In the document of the zipfile module, I note that it mentions the > file-like object? wh

Re: Could zipfile module process the zip data in memory?

2007-04-29 Thread John Machin
On Apr 29, 9:15 pm, 人言落日是天涯,望极天涯不见家 <[EMAIL PROTECTED]> wrote: > I made a C/S network program, the client receive the zip file from the > server, and read the data into a variable. how could I process the > zipfile directly without saving it into file. > In the document of the

Could zipfile module process the zip data in memory?

2007-04-29 Thread 人言落日是天涯,望极天涯不见家
I made a C/S network program, the client receive the zip file from the server, and read the data into a variable. how could I process the zipfile directly without saving it into file. In the document of the zipfile module, I note that it mentions the file-like object? what does it mean? class

Re: Zipping files/zipfile module

2006-08-02 Thread Brian Beck
Yves Lange wrote: > Other solutions: > you can try the rar command line from WinRar but it's not recommended. > This is a very slow manner to compress file. Are you sure? This worked about 4 times faster than the zip command line utility in Linux, compressing the same files... -- Brian Beck Adve

Re: Zipping files/zipfile module

2006-08-02 Thread Ant
Enabling directory recursion: > from os import listdir, mkdir > from os.path import join, basename, isfile > from zipfile import ZipFile > > def zip_dir(path, output_path, include_hidden=True): > try: > mkdir(output_path) > except OSError, e: > if e.errno == 17: # Path exis

Re: Zipping files/zipfile module

2006-08-02 Thread Yves Lange
Simon Forman a écrit : > Brian Beck wrote: >> OriginalBrownster wrote: >>> I want to zip all the files within a directory called "temp" >>> and have the zip archive saved in a directory with temp called ziptemp >>> >>> I was trying to read

Re: Zipping files/zipfile module

2006-08-02 Thread Simon Forman
Brian Beck wrote: > OriginalBrownster wrote: > > I want to zip all the files within a directory called "temp" > > and have the zip archive saved in a directory with temp called ziptemp > > > > I was trying to read up on how to use the zipfile module python &g

Re: Zipping files/zipfile module

2006-08-01 Thread Brian Beck
OriginalBrownster wrote: > I want to zip all the files within a directory called "temp" > and have the zip archive saved in a directory with temp called ziptemp > > I was trying to read up on how to use the zipfile module python > provides, but I cannot seem to find

Zipping files/zipfile module

2006-08-01 Thread Thomas Thomas
Hi Stephen,   some code that I have been using for a similar purpose.   def addFolderToZip(myZipFile,folder):    folder = folder.encode('ascii') #convert path to ascii for ZipFile Method    for file in glob.glob(folder+"/*"):    if os.path.isfile(file):    print fil

Zipping files/zipfile module

2006-08-01 Thread OriginalBrownster
This will probably sound like a very dumb question. I am trying to zip some files within a directory. I want to zip all the files within a directory called "temp" and have the zip archive saved in a directory with temp called ziptemp I was trying to read up on how to use the zipf

Re: zipfile module doesn't allow append

2006-06-29 Thread Roger Miller
Ritesh Raj Sarraf wrote: > The line > filename = zipfile.ZipFile(zip_file_name, "a") > throws an exception if the given filename is not present already. > Shouldn't it create a file (in case one is not there) since it is > "append" mode ?? Perhaps it would be nicer that way, but it is working as

zipfile module doesn't allow append

2006-06-29 Thread Ritesh Raj Sarraf
Hi, I've got a problem here. def compress_the_file(zip_file_name, files_to_compress, sSourceDir): """ Condenses all the files into one single file for easy transfer """ try: import zipfile except ImportError: sys.stderr.write("Ai! module not found.\n")

Re: memory error with zipfile module

2006-06-21 Thread Fredrik Lundh
Hari Sekhon wrote: > I've seen people using everything from zip to touch, either out of > laziness or out of the fact it wouldn't work very well in python, this > zip case is a good example. so based on a limitation in one library, and some random code you've seen on the internet, you're makin

Re: memory error with zipfile module

2006-06-21 Thread Hari Sekhon
Fredrik Lundh wrote: Hari Sekhon wrote: I take it that it's still a work in progress to be able to pythonify everything, and until then we're just gonna have to rely on shell and those great C coded coreutils and stuff like that. Ok, I'm rather fond of Bash+coreutils, highest r

Re: memory error with zipfile module

2006-06-21 Thread Fredrik Lundh
Hari Sekhon wrote: > I take it that it's still a work in progress to be able to pythonify > everything, and until then we're just gonna have to rely on shell and > those great C coded coreutils and stuff like that. Ok, I'm rather fond > of Bash+coreutils, highest ratio of code lines to work I'v

Re: memory error with zipfile module

2006-06-21 Thread Hari Sekhon
Fredrik Lundh wrote: Hari Sekhon wrote: Is it me or is having to use os.system() all the time symtomatic of a deficiency/things which are missing from python as a language? it's you. I take it that it's still a work in progress to be able to pythonify everything

Re: memory error with zipfile module

2006-06-21 Thread Fredrik Lundh
Hari Sekhon wrote: > Is it me or is having to use os.system() all the time symtomatic of a > deficiency/things which are missing from python as a language? it's you. -- http://mail.python.org/mailman/listinfo/python-list

Re: memory error with zipfile module

2006-06-21 Thread Hari Sekhon
On 20/05/06, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: Roger Miller a écrit :> The basic problem is that the zipfile interface only reads and writes> whole files, so it may perform poorly or fail on huge files.   At one> time I implemented a patch to allow reading files in chunks. However I >

Re: memory error with zipfile module

2006-05-19 Thread Bruno Desthuilliers
Roger Miller a écrit : > The basic problem is that the zipfile interface only reads and writes > whole files, so it may perform poorly or fail on huge files. At one > time I implemented a patch to allow reading files in chunks. However I > believe that the current interface has too many problems

Re: memory error with zipfile module

2006-05-19 Thread Roger Miller
The basic problem is that the zipfile interface only reads and writes whole files, so it may perform poorly or fail on huge files. At one time I implemented a patch to allow reading files in chunks. However I believe that the current interface has too many problems to solve by incremental patching,

Re: memory error with zipfile module

2006-05-19 Thread bruno at modulix
Sion Arrowsmith wrote: > Hari Sekhon <[EMAIL PROTECTED]> wrote: (snip) >>The python zipfile module is obviously broken... > > This isn't at all obvious to me. zipfile.read() does not seem to take full advantage of zlib's decompressobj's features. This c

Re: memory error with zipfile module

2006-05-19 Thread Sion Arrowsmith
bruno at modulix <[EMAIL PROTECTED]> wrote: >http://mail.zope.org/pipermail/zope/2004-October/153882.html >""" >MemoryError is raised by Python when an underlying (OS-level) allocation >fails. >(...) >Normally this would mean that you were out of even virtual memory >(swap), but it could also be a

Re: memory error with zipfile module

2006-05-19 Thread Sion Arrowsmith
e it. How big is cdimage.zip? How big is the uncompressed someimage.iso? How much memory do you have? >The python zipfile module is obviously broken... This isn't at all obvious to me. -- \S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/ ___ | "Frankly I have no feelin

Re: memory error with zipfile module

2006-05-19 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > Take a look at the pywin32 extension, which I believe has some lower > level memory allocation and file capabilities that might help you in > this situation. But then the solution would not be portable, which would be a shame since the zlib module (on which ZipFile reli

Re: memory error with zipfile module

2006-05-19 Thread [EMAIL PROTECTED]
Take a look at the pywin32 extension, which I believe has some lower level memory allocation and file capabilities that might help you in this situation. If I'm completely wrong, someone please tell me XD. Of course, you could just make the read() a step process, reading, O lets say 8192 bytes at

Re: memory error with zipfile module

2006-05-19 Thread bruno at modulix
x27;) csize = info.compress_size fsize = info.file_size print "someimage compressed size is : %s" % csize print "someimage real file size is : %s" % fsize print """ So, knowing how zipfile.read() is actually implemented, total needed ram is : %s ""&quo

Re: memory error with zipfile module

2006-05-19 Thread Ganesan Rajagopal
file is huge. Even if it's only a CD image (approx 650MB), reading it all into memory in a single string is not a good idea. > The python zipfile module is obviously broken... Indeed. I am surprised that there is no API that returns a file object. Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

memory error with zipfile module

2006-05-19 Thread Hari Sekhon
both result in the same error: Traceback (most recent call last): File "", line 1, in ? File "D:\u\Python24\lib\zipfile.py", line 357, in read bytes = dc.decompress(bytes) MemoryError I thought python was supposed to handle memory for you? The python zipfile module i

zipfile module

2006-03-29 Thread Rajesh Sathyamoorthy
Hi,I know how to write files to a zip file but i was wondering if there was a way to add a empty folder to the zip file using the zipfile module? I can only write files and not directories to a zip file.Thank You. -- http://mail.python.org/mailman/listinfo/python-list

zipfile module and directories and symlinks

2005-04-21 Thread Jim
I'm using the zipfile module to unpack bundles. Is there a Right way to recognize directories, or do I just check if the name ends in '/' (i.e., os.sep)? That is, I have this. for bundleInfo in bundleObject.infolist(): ...stuff... if bundleInfo.filename[-1:]==os.sep:

Re: zlib and zipfile module in Python2.4

2005-04-12 Thread Fredrik Lundh
Bill Anderson wrote: > I recently had this issue and discovered that if zlib headers are not > there, python still builds gzip ... which imports zlib. Seems to me that > since zlib apparently depends on gzip, gzip should only be built if zlib > is. gzip is a Python module, and isn't "built". if

Re: zlib and zipfile module in Python2.4

2005-04-12 Thread Bill Anderson
On Mon, 11 Apr 2005 10:38:37 -0400, Alan Toppen wrote: > I was unable to use the ZipFile class in the zipfile module in > Python2.4. I got an error that zlib could not be found. Comparing my > Python 2.2 installation I noticed Python 2.4 was missing a certain file: > /usr/lib/p

Re: zlib and zipfile module in Python2.4

2005-04-11 Thread Fredrik Lundh
Alan Toppen wrote: > When running my Python script it gives a warning: > > /usr/local/lib/python2.4/zipfile.py:7: RuntimeWarning: Python C API version > mismatch for module zlib: This Python has C API version 1012, module zlib > has version 1011. > import zlib # We may need its compression metho

zlib and zipfile module in Python2.4

2005-04-11 Thread Alan Toppen
I was unable to use the ZipFile class in the zipfile module in Python2.4. I got an error that zlib could not be found. Comparing my Python 2.2 installation I noticed Python 2.4 was missing a certain file: /usr/lib/python2.2/lib-dynload/zlibmodule.so. Unable to find a more elegant solution, I