<p><br>
On Aug 27, 2012 3:47 PM, "Tim Johnson" <<a href="mailto:tim@akwebsoft.com">tim@akwebsoft.com</a>> wrote:<br>
><br>
> In bash I do the following:<br>
> linus:journal tim$ /home/AKMLS/cgi-bin/perl/processJournal-Photo.pl hiccup<br>
> -bash: /home/AKMLS/cgi-bin/perl/processJournal-Photo.pl: No such file or directory<br>
> linus:journal tim$ echo $?<br>
> 127<br>
><br>
> In python, use os.popen4 I do the following:<br>
> >>> fin,fout = os.popen4('/home/AKMLS/cgi-bin/perl/processJournal-Photo.pl hiccup;echo $?')<br>
> >>> results = fout.readlines()<br>
> >>> results<br>
> ['/bin/sh: /home/AKMLS/cgi-bin/perl/processJournal-Photo.pl: No such file or directory\n', '127\n']<br>
><br>
> Well, I got the exit code as the last item in the results, but I'm wondering if<br>
> there is a better way. From help(os) - I don't find any variables dedicated to<br>
> holding exit status.<br>
><br>
> Any ideas?<br>
> thanks<br>
> --<br>
> Tim<br>
> tim at tee jay forty nine dot com or akwebsoft dot com<br>
> <a href="http://www.akwebsoft.com">http://www.akwebsoft.com</a></p>
<p>The popen* functions are deprecated. You should use the subprocess module instead. <br>
</p>