Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #100454 > unrolled thread

subprocess.call with non-ASCII arguments?

Started byUlli Horlacher <framstag@rus.uni-stuttgart.de>
First post2015-12-15 12:51 +0000
Last post2015-12-15 12:51 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  subprocess.call with non-ASCII arguments? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-12-15 12:51 +0000

#100454 — subprocess.call with non-ASCII arguments?

FromUlli Horlacher <framstag@rus.uni-stuttgart.de>
Date2015-12-15 12:51 +0000
Subjectsubprocess.call with non-ASCII arguments?
Message-ID<n4p2cc$ifa$1@news2.informatik.uni-stuttgart.de>
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/

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web