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

  • Home
  • SEARCH
  • 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 9159081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:24:24+00:00 2026-06-17T13:24:24+00:00

I am struggling to use subprocesses with python. Here is my task: Start an

  • 0

I am struggling to use subprocesses with python. Here is my task:

  1. Start an api via the command line (this should be no different than running any argument on the command line)
  2. Verify my API has come up. The easiest way to do this would be to poll the standard out.
  3. Run a command against the API. A command prompt appears when I am able to run a new command
  4. Verify the command completes via polling the standard out (the API does not support logging)

What I’ve attempted thus far:
1. I am stuck here using the Popen. I understand that if I use
subprocess.call("put command here") this works. I wanted to try to use something similar to:

import subprocess

def run_command(command):
  p = subprocess.Popen(command, shell=True,
                       stdout=subprocess.PIPE,
                       stderr=subprocess.STDOUT)

where I use run_command("insert command here") but this does nothing.

with respect to 2. I think the answer should be similar to here:
Running shell command from Python and capturing the output,
but as I can’t get 1. to work, I haven’t tried that yet.

  • 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-17T13:24:25+00:00Added an answer on June 17, 2026 at 1:24 pm

    To at least really start the subprocess, you have to tell the Popen-object to really communicate.

    def run_command(command):
        p = subprocess.Popen(command, shell=True,
                stdout=subprocess.PIPE,
                stderr=subprocess.STDOUT)
        return p.communicate()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm struggling with the following scenario and could use some different perspectives to shed
I´m struggling to learn obj-C and could use some help. I´m writing a command
I have been struggling with this for a while and could really use some
first time questioner here. I'm currently struggling on how to use Beaker properly using
This is my first time to use require.js with backbone, and I'm struggling to
I'm trying to use Relay command from MVVMLight and I'm struggling to find the
I use playframework, and I am struggling with a concurrent task: I have a
I'm struggling to find a definition of how to use the set cypher command
I'm struggling to understand the proper way to use noConflict in this context: My
I'm currently struggling to use UI elements in Interface Builder. I keep trying to

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.