Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100454
| From | Ulli Horlacher <framstag@rus.uni-stuttgart.de> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | subprocess.call with non-ASCII arguments? |
| Date | 2015-12-15 12:51 +0000 |
| Organization | University of Stuttgart, FRG |
| Message-ID | <n4p2cc$ifa$1@news2.informatik.uni-stuttgart.de> (permalink) |
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)
leads to:
File "fexit.py", line 971, in sendfile_retry
status = subprocess.call(cmd)
File "C:\Python27\lib\subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "C:\Python27\lib\subprocess.py", line 710, in __init__
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 958, in _execute_child
startupinfo)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 87:
ordinal not in range(128)
This is because the array "files" contains filenames with non-ASCII
characters.
So, the problem is in subprocess.py, which I cannot modify.
What can I do?
--
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 | Find similar | Unroll thread
subprocess.call with non-ASCII arguments? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-12-15 12:51 +0000
csiph-web