Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing first argument on subprocess.Popen w/ executable #50391

Closed
lieryan mannequin opened this issue May 29, 2009 · 4 comments
Closed

missing first argument on subprocess.Popen w/ executable #50391

lieryan mannequin opened this issue May 29, 2009 · 4 comments
Assignees
Labels
docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@lieryan
Copy link
Mannequin

lieryan mannequin commented May 29, 2009

BPO 6141
Nosy @birkenfeld, @bitdancer
Files
  • issue6141-doc.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/birkenfeld'
    closed_at = <Date 2009-05-29.19:31:07.457>
    created_at = <Date 2009-05-29.10:06:49.459>
    labels = ['type-bug', 'library', 'docs']
    title = 'missing first argument on subprocess.Popen w/ executable'
    updated_at = <Date 2009-05-29.19:31:07.455>
    user = 'https://bugs.python.org/lieryan'

    bugs.python.org fields:

    activity = <Date 2009-05-29.19:31:07.455>
    actor = 'r.david.murray'
    assignee = 'georg.brandl'
    closed = True
    closed_date = <Date 2009-05-29.19:31:07.457>
    closer = 'r.david.murray'
    components = ['Documentation', 'Library (Lib)']
    creation = <Date 2009-05-29.10:06:49.459>
    creator = 'lieryan'
    dependencies = []
    files = ['14111']
    hgrepos = []
    issue_num = 6141
    keywords = ['patch']
    message_count = 4.0
    messages = ['88504', '88510', '88522', '88525']
    nosy_count = 3.0
    nosy_names = ['georg.brandl', 'r.david.murray', 'lieryan']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue6141'
    versions = ['Python 2.6', 'Python 3.0', 'Python 3.1', 'Python 2.7', 'Python 3.2']

    @lieryan
    Copy link
    Mannequin Author

    lieryan mannequin commented May 29, 2009

    Following from http://comments.gmane.org/gmane.comp.python.tutor/55576

    >>> import subprocess
    >>> subprocess.Popen(['a', 'b', 'c', 'd'], executable='echo')
    <subprocess.Popen object at 0x7fdf7bb2bd50>
    b c d

    instead of the (what I) expected result
    a b c d

    I suggests two possible change:

    1. add another optional argument called displayed_executable (or
      something similar) and make the arg argument contains only arguments
    2. it is made clear in the documentation that the first argument is used
      as executable display name

    Since the first alternative is behavioral change, it couldn't possibly
    go through already released version; therefore if it is the chosen
    solution it would have to go to Python 2.7 and Python 3.2.

    Changing the documentation should be easier, although the problem will
    persist for unsuspecting users; and even if the first alternative is
    taken, perhaps documentation change should still be done retrospectively
    (I don't know the policy on doc change on old python version)

    It should be noted that I tested this only with Python 2.5 on Gentoo
    (although from the discussion, I presumed this is considered a feature
    and would have persisted in later versions). And at the time of this
    writing, I have no idea how it behaves in Windows.

    @lieryan lieryan mannequin assigned birkenfeld May 29, 2009
    @lieryan lieryan mannequin added docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels May 29, 2009
    @bitdancer
    Copy link
    Member

    The way it works is the way most programmers expect it to work, even
    though most get bitten by it more than once. So the behavior isn't
    going to change. I've attached a doc fix, but I'm not sure whether or
    not the 'diplay name' piece applies only to unix, although I've
    documented it that way. The windows documentation I found for
    CreateProcess does not mention it, though it does note that "most C
    programmers" treat argv[0] as the process name, consistent with the way
    subprocess handles the argument string.

    The Windows documentation I consulted is here:

    http://msdn.microsoft.com/en-us/library/ms682425.aspx

    @birkenfeld
    Copy link
    Member

    Patch looks good, just replace `ps` by :program:`ps` please.

    @bitdancer
    Copy link
    Member

    Fixed in r73026, thanks.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants