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 8074829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:47:08+00:00 2026-06-05T14:47:08+00:00

str = blah -l cpuinfo = subprocess.Popen(str.split(),stdout=PIPE,stderr=PIPE) tuples = cpuinfo.communicate() In the above code,

  • 0
    str = "blah -l"
    cpuinfo = subprocess.Popen(str.split(),stdout=PIPE,stderr=PIPE)

    tuples = cpuinfo.communicate()

In the above code, when I give str=[some_valid_command] gives the output to tuples. When I give an invalid command, I expect the error to be taken to PIPE, but it is still throwing out on the console…. I am not quite sure, where I understood it wrong….

Thanks…..

  • 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-05T14:47:09+00:00Added an answer on June 5, 2026 at 2:47 pm

    I’m not sure if you are seeing the stderr actually appear on the console, or are simply running into the Python failure to spawn a process named “blah”, which is produced when running the example that you provided…

    The output of the example would be Python raising an OSError: [Errno 2] No such file or directory, which is to be expected unless you have an executable script called “blah” in the PATH

    I did a simple test, and wrote a bash script like this:

    #!/bin/bash
    
    echo "This is stdout"
    echo "This is a failure on stderr" >&2
    exit 1
    

    After giving that script executable permissions, I repeated your example but instead called my script (named fail.sh in the local directory) as such:

    import subprocess
    
    cmd = './fail.sh'
    proc = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    proc.communicate()
    

    This returned ('This is stdout\n', 'This is a failure on stderr\n') as expected.

    So perhaps what you’re really seeing here is that whatever program you’re trying to call (if it’s not blah), simply doesn’t exist on your PATH.

    Also a note on using str as a label in Python: str is a built-in type and should not be used as a name for a variable or function, unless you specifically want to “over-load” the built-in function. Same goes for string, which is a class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

string str = abcdefgdcb; cout << sizeof(str.substr(0,3).c_str()); For some reason, the above string is
if(str.contains(final)) { id = Integer.parseInt(str.substring(18, str.length() - 6)); } System.out.println(id); This line of code
Just a simple question: str = ['blah','blah'] for word in str: word = word
str := new(bytes.Buffer) //old code printer.Fprint(str, c) //old code str := new(token.FileSet) //new code
str(file.key) = '1011/101011/file_name' newFileName = str(file.key) But, when I run the code i get:
This is a piece of my code... def contactMaster(data=,url= str(chosenMaster)+todolist): print url: +url It
str = "&&"; label1.Text = str; but it only shows "&". How do I
char str[]=Hello; this allocates 6 bytes for the string , but if i write
(define str '(3 + 3)) (define list '(3 + 4)) (define (tokes str) (case
free(str); printf(%d\n, str->listeners); The call to printf succeeds (as do any other calls 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.