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