homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: subprocess.Popen() TypeError message incorrect without args argument
Type: behavior Stage: needs patch
Components: Library (Lib) Versions: Python 3.2, Python 3.3, Python 3.4, Python 2.7
process
Status: open Resolution:
Dependencies: 16543 Superseder:
Assigned To: Nosy List: carlbordum, chris.jerdonek, ezio.melotti, mark.dickinson, nanjekyejoannah
Priority: normal Keywords:

Created on 2012年11月21日 08:45 by chris.jerdonek, last changed 2022年04月11日 14:57 by admin.

Messages (6)
msg176047 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012年11月21日 08:45
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.
msg176048 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2012年11月21日 08:56
I don't think the first part of the report has anything to do with subprocess.Popen:
>>> def f(x):
... return
... 
>>> f()
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
TypeError: f() missing 1 required positional argument: 'x'
See the related discussion starting at:
http://mail.python.org/pipermail/python-dev/2012-September/121760.html 
msg176049 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012年11月21日 09:12
Also see the terminology-related issue 15990 created from that thread.
msg176069 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2012年11月21日 18:08
By the way, I think this message from Nick is the closest to a resolution from that thread:
"We've already had this terminology discussion and documented the results in PEP 362. The rest of the docs may require updates to be brought in line with that."
(http://mail.python.org/pipermail/python-dev/2012-September/121791.html)
msg176071 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012年11月21日 18:46
> TypeError: __init__() missing 1 required positional argument: 'args'
I think something like the following would be more correct:
__init__() missing argument for parameter 'args'
msg347828 - (view) Author: Carl Bordum Hansen (carlbordum) * Date: 2019年07月13日 14:35
I think changing the message will break a lot of tests.
Here are some examples just from CPython:
https://github.com/python/cpython/blob/master/Lib/test/test_dataclasses.py#L2655
https://github.com/python/cpython/blob/master/Lib/test/test_extcall.py
It would also outdate some documentation examples.
History
Date User Action Args
2022年04月11日 14:57:38adminsetgithub: 60724
2019年07月13日 14:35:33carlbordumsetnosy: + carlbordum
messages: + msg347828
2019年04月18日 21:12:33nanjekyejoannahsetnosy: + nanjekyejoannah
2012年11月24日 20:25:50chris.jerdoneksetdependencies: + improve TypeError messages for missing arguments (meta issue)
2012年11月21日 18:46:07chris.jerdoneksetmessages: + msg176071
2012年11月21日 18:08:28mark.dickinsonsetmessages: + msg176069
2012年11月21日 18:06:01ezio.melottisetnosy: + ezio.melotti

stage: needs patch
2012年11月21日 09:12:23chris.jerdoneksetmessages: + msg176049
2012年11月21日 08:56:03mark.dickinsonsetnosy: + mark.dickinson
messages: + msg176048
2012年11月21日 08:45:12chris.jerdonekcreate

AltStyle によって変換されたページ (->オリジナル) /