Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100504
| From | Ulli Horlacher <framstag@rus.uni-stuttgart.de> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: subprocess.call with non-ASCII arguments? |
| Date | 2015-12-16 12:44 +0000 |
| Organization | University of Stuttgart, FRG |
| Message-ID | <n4rmb0$89k$1@news2.informatik.uni-stuttgart.de> (permalink) |
| References | <n4p7te$jrg$1@news2.informatik.uni-stuttgart.de> <mailman.22.1450191839.22044.python-list@python.org> |
Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote: > >I want to create a zip file within a Python 2.7 program on windows. > > > >My code: > > > > cmd = ['7za.exe','a','-tzip',archive] + files > > status = subprocess.call(cmd) > > > My first thought would be... > > WHY spawn an OS dependent subprocess... > > Python has a zipfile library that is portable between OS. Along with > libraries for gzip, bzip2, and tarfiles... Great hint! With the python modules zipfile and tarfile I have no more problems with non-ASCII filenames! It needed a little bit more programming with os.walk(), because zipfile cannot add directories recursivly. S:\>python fexit.py * framstag Container name: test creating C:\Users\admin\AppData\Local\Temp\fex\test.zip zip dist\fexit.exe zip mf.cmd zip fex.ico zip fexit.spec zip build\fexit\fexit.exe.manifest zip build\fexit\out00-Analysis.toc zip build\fexit\out00-EXE.toc zip build\fexit\out00-PKG.pkg zip build\fexit\out00-PKG.toc zip build\fexit\out00-PYZ.pyz zip build\fexit\out00-PYZ.toc zip build\fexit\out00-Tree.toc zip build\fexit\out01-Tree.toc zip build\fexit\warnfexit.txt zip fexit.py zip tar.py zip zip.py Recipient: framstag@rus.uni-stuttgart.de test.zip: 13 MB of 13 MB (100%) 28540 kB/s -- Ullrich Horlacher Server und Virtualisierung Rechenzentrum IZUS/TIK E-Mail: horlacher@tik.uni-stuttgart.de Universitaet Stuttgart Tel: ++49-711-68565868 Allmandring 30a Fax: ++49-711-682357 70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
subprocess.call with non-ASCII arguments? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-12-15 14:25 +0000
Re: subprocess.call with non-ASCII arguments? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-12-15 10:03 -0500
Re: subprocess.call with non-ASCII arguments? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-12-15 17:57 +0000
Re: subprocess.call with non-ASCII arguments? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-12-15 21:20 -0500
Re: subprocess.call with non-ASCII arguments? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-12-16 12:44 +0000
Re: subprocess.call with non-ASCII arguments? wxjmfauth@gmail.com - 2015-12-16 06:55 -0800
Re: subprocess.call with non-ASCII arguments? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-12-15 15:05 +0000
Re: subprocess.call with non-ASCII arguments? Laura Creighton <lac@openend.se> - 2015-12-15 16:08 +0100
csiph-web