[New-bugs-announce] [issue16520] subprocess.Popen() TypeError message incorrect without args argument

Chris Jerdonek report at bugs.python.org
Wed Nov 21 09:45:12 CET 2012


New submission from Chris Jerdonek:

The TypeError message when a call to subprocess.Popen() lacks the args argument is incorrect.

For 3.3 and 3.4, the message incorrectly says that a positional argument is required when a keyword argument will do:

>>> import subprocess
>>> subprocess.Popen()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() missing 1 required positional argument: 'args'
>>> subprocess.Popen(args=['test'])
<subprocess.Popen object at 0x10bed4840>

For 3.2 and 2.7, the problem is slightly different.  It says that two arguments are needed and that two have been given:

>>> subprocess.Popen()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() takes at least 2 arguments (1 given)
>>> subprocess.Popen(shell=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() takes at least 2 arguments (2 given)

I don't know if this issue affects other functions in the standard library, but I suspect it might.

----------
components: Library (Lib)
messages: 176047
nosy: chris.jerdonek
priority: normal
severity: normal
status: open
title: subprocess.Popen() TypeError message incorrect without args argument
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

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


More information about the New-bugs-announce mailing list