Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8088681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:09:43+00:00 2026-06-05T19:09:43+00:00

I have an instance of the Popen class created through subprocess.Popen. I would like

  • 0

I have an instance of the Popen class created through subprocess.Popen. I would like to get the name of that process, but I can’t find any method or instance variable that would let me get at that. For example, if I had:

p = subprocess.Popen('ls')

I would like to find a method to give me the name of the process, something that would work like:

>>> p.name()
ls
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:09:45+00:00Added an answer on June 5, 2026 at 7:09 pm

    The answer is no, until the latest versions of Python (non-stable).

    Looking at the source for 3.2.3, you can see that information isn’t stored in the object (it is discarded). However, in the latest development version of Python, it has been added as subprocess.Popen.args.

    So, presuming this makes it into 3.3, the only time you will see this as a feature is then. The development docs don’t mention it, but that could just be them not being updated. The fact that it’s not prefixed with an underscore (_args) implies that it is intended to be a public attribute.

    If you are desperate to do this as part of the object, the easiest answer is simply to subclass subprocess.Popen() and add the data yourself. That said, I really don’t think it’s worth the effort in most cases.

    >>> class NamedPopen(Popen):
    ...     def __init__(self, cargs, *args):
    ...         Popen.__init__(self, cargs, *args)
    ...         self.args = cargs
    ... 
    >>> x = NamedPopen("ls")
    >>> x.args
    'ls'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assuming I have a instance of class A (name it AI) that has an
I have an instance of Class A that I want to refer to in
I have some instance variables in my class that I'd want to be accessible
I'd like to create a Python class decorator (*) that would be able to
I have an instance of MemoryStream that is closed (don't ask, can't change that
I have an instance method that I'd like to invoke directly using the callback
I have 2 instance in windows azure. I am finding that only one instance
I have an instance of an EF entity that im serializing to JSON. Is
Can we have multiple instance of a Service in Android ? I want a
I have installed SQL Server 2005 and now have instance name as the default

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.