[issue4035] Support bytes for os.exec*()

STINNER Victor report at bugs.python.org
Sat Oct 4 01:38:24 CEST 2008


New submission from STINNER Victor <victor.stinner at haypocalc.com>:

os.exec*() functions doesn't support bytes if the program name doesn't 
use absolute path. The problem is that PATH is used to complete the 
full path but Python3 disallows bytes+str (which is a good thing!). 
Example:

python -c "import os; os.execvp('pwd', 'pwd')"
Traceback (most recent call last):
  ...
  File "/home/haypo/prog/py3k/Lib/os.py", line 328, in execvp
    _execvpe(file, args)
  File "/home/haypo/prog/py3k/Lib/os.py", line 364, in _execvpe
    func(fullname, *argrest)
TypeError: execv() arg 2 must be a tuple or list

Attached patch allows bytes in os.exec*(). It converts each directory 
of PATH using sys.getfilesystemencoding().

----------
files: os_exec_bytes.patch
keywords: patch, patch
messages: 74283
nosy: haypo
severity: normal
status: open
title: Support bytes for os.exec*()
versions: Python 3.0
Added file: http://bugs.python.org/file11695/os_exec_bytes.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4035>
_______________________________________


More information about the Python-bugs-list mailing list