[issue26493] Bad formatting in WinError 193 when using subprocess.check_call

Berker Peksag report at bugs.python.org
Mon Apr 29 13:34:55 EDT 2019


Berker Peksag <berker.peksag at gmail.com> added the comment:

FYI, in msg261315, Eryk has mentioned about possible improvement of the exception message on POSIX. The filename has been added to the exception message in 8621bb5d93239316f97281826461b85072ff6db7:

>>> import subprocess, os
>>> os.access('log.txt', os.X_OK)
True
>>> subprocess.call(['./log.txt'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/berkerpeksag/projects/cpython/Lib/subprocess.py", line 325, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/Users/berkerpeksag/projects/cpython/Lib/subprocess.py", line 830, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/berkerpeksag/projects/cpython/Lib/subprocess.py", line 1648, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: './log.txt'

----------
nosy: +berker.peksag
stage:  -> needs patch
versions: +Python 3.8 -Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue26493>
_______________________________________


More information about the Python-bugs-list mailing list