[New-bugs-announce] [issue26493] Bad formatting in WinError 193 when using subprocess.check_call

Raúl Núñez de Arenas report at bugs.python.org
Sun Mar 6 11:56:29 EST 2016

New submission from Raúl Núñez de Arenas:

Python 3.5.1 x64 @ Windows 10 x64

The error message in the traceback for OSError/WinError 193 has bad formatting and the offending file name is not printed.

For example, this code:
import subprocess

testfile = open('testfile.notexecutable', 'wb')

produces this output:
Traceback (most recent call last):
  File "test.py", line 6, in <module>
  File "C:\Program Files\Python35\lib\subprocess.py", line 579, in check_call
    retcode = call(*popenargs, **kwargs)
  File "C:\Program Files\Python35\lib\subprocess.py", line 560, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\Program Files\Python35\lib\subprocess.py", line 950, in __init__
    restore_signals, start_new_session)
  File "C:\Program Files\Python35\lib\subprocess.py", line 1220, in _execute_child
OSError: [WinError 193] %1 is not a valid Win32 application

Please note the "%1 is not a valid..." on the last line. Instead of the "%1" placeholder, the filename ("testfile.notexecutable") should appear instead.

Thanks :)

messages: 261262
nosy: Raúl Núñez de Arenas
priority: normal
severity: normal
status: open
title: Bad formatting in WinError 193 when using subprocess.check_call
versions: Python 3.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list