Execute subprocess sequentially in python
<p>I am trying to the following 2 commands in python one after another.</p>

<pre><code>runmqsc &lt;Queuem manager name&gt;
Display QL (&lt;queue name&gt;)
</code></pre>

<p>I can execute the rumqsc command using subprocess. </p>

<pre><code>subprocess.call("runmqsc &lt;queue manager name&gt;", shell= True)
</code></pre>

<p>Now this commands seems like taking the control from python. If i try to execute the next command using subprocess its not working as expected.
I am not even sure how to execute the second(for which i have to pass an argument). </p>

<p>Adding the code snippet:</p>

<pre><code>subprocess.call("runmqsc Qmgrname", shell= True)
subprocess.call("DISPLAY QL(&lt;quename&gt;)",shell=True)
</code></pre>

<p>Now the first line executes fine and as mentioned by tdelaney in the comment runmqsc waits for input from stdin. And after executing the first line the program hangs without even executing the second line.</p>

<p>Any help or references to any of the related document would help. 
Thanks</p>

<p>On Unix, Linux or Windows, you can simply do:</p>

<pre><code>runmqsc QMgrName &lt; some_mq_cmds.mqsc &gt; some_mq_cmds.out
</code></pre>

<p>In the 'some_mq_cmds.mqsc' file, put your MQSC commands like: </p>

<pre><code>DISPLAY QL("TEST.Q1")
</code></pre>

python unix subprocess websphere-mq-fte