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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:54:02+00:00 2026-05-28T16:54:02+00:00

code: proc=subprocess.Popen([‘sh’,shFile],stderr=subprocess.PIPE,stdout=subprocess.PIPE) out,err = proc.communicate() Problem: shFile in line 1 runs several shell scripts.

  • 0

code:

proc=subprocess.Popen(['sh',shFile],stderr=subprocess.PIPE,stdout=subprocess.PIPE)

out,err = proc.communicate()

Problem:

shFile in line 1 runs several shell scripts. When I execute shFile from bash, all the shell scripts are executed. However when I execute it using subprocess.Popen, the last shell script is not executed. Interestingly the last line of the shFile is “echo ‘Done'”, which gets executed.

The last 6 lines of shFile are:

sh /export/hierMultiStream_audSpec_direct/tempScripts/decoder__20_eval.sh
sh /export/hierMultiStream_audSpec_direct/tempScripts/decoder__5_eval.sh
sh /export/hierMultiStream_audSpec_direct/tempScripts/decoder__20_eval.sh
sh /export/hierMultiStream_audSpec_direct/tempScripts/decoder__15_eval.sh
sh /export/hierMultiStream_audSpec_direct/tempScripts/decoder__10_eval.sh
echo "Done"

Only decoder__10_eval.sh is not executed. If I change the order of the scripts, once again the last one fails to execute.

  • 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-05-28T16:54:03+00:00Added an answer on May 28, 2026 at 4:54 pm

    subprocess does not do any magic. Note that sh is often not bash on modern Linux systems, but a lightweight shell such as dash. If your shell script is bash-specific, you therefore need to change 'sh' to 'bash'.

    In any case, it is extremely unlikely (less likely than winning the lottery ten times in a row) that sh (or bash) would “forget” to execute a line in a script. Also make sure that shFile is what you expect.

    Looking at your updated script, the error is almost certainly in the scripts you evaluate. For example, they might simply run out of temporary files or other inadvertently shared resources. Please post the decoder__ scripts, or reproduce the problem with shFile containing:

    /bin/echo sh /export/hierMultiStream_audSpec_direct/tempScripts/decoder__20_eval.sh
    /bin/echo sh /export/hierMultiStream_audSpec_direct/tempScripts/decoder__5_eval.sh
    /bin/echo sh /export/hierMultiStream_audSpec_direct/tempScripts/decoder__20_eval.sh
    /bin/echo sh /export/hierMultiStream_audSpec_direct/tempScripts/decoder__15_eval.sh
    /bin/echo sh /export/hierMultiStream_audSpec_direct/tempScripts/decoder__10_eval.sh
    echo "Done"
    

    If the “10” output is missing, then you’ve really got a problem with sh. Otherwise (and again, with extremely high certainty), the problem lies in the tempScripts you’re executing.

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

Sidebar

Related Questions

I am executing the python command, proc = subprocess.Popen(cmd, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, )
I have the following code which ends up forever reading '/proc/cpuinfo' as it keeps
I copy and paste code from this URL for creating and reading/writing a proc
I am getting error trying to run my asp code for executing stored proc.
I try to read file /proc/'pid'/status, using c program. The code is as follows,
I have code here proc checkPrime {no} { set i 1 set count 0
So I would like to grab stdout from a subprocess and then write the
This code generates AttributeError: 'Popen' object has no attribute 'fileno' when run with Python
I have some PROC REPORT code that generates a report with 2 levels of
A long running shell script produces stdout and stderr, which I would like 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.