[Tutor] launching and monitor from make

Michael P. Reilly arcege at gmail.com
Wed Oct 12 16:59:51 CEST 2005


On 10/12/05, Ertl, John <john.ertl at fnmoc.navy.mil> wrote:
>
> I have a very simple python program that reads one file and overwrites
> anouther text file. This workes great from the command line and it has
> error checking but just outputs messages and the like to the screen.
>
> The CM team here would like to have the script run each week as part of
> the
> automated rebuilds. The suggestion was to make the execution of the scritp
> part of the bigger programs make file. How would I handel errors when the
> program is run from a makefile? I hate make so I have not done a lot of
> playing with what make can do in this respect but can python get an error
> message to make?
>

In general, you want error messages to go to sys.stderr and you want to
return an error code other than zero.

Send messages to stderr:
print >>sys.stderr, message

Return error code
raise SystemExit(1)

At this point, make will respond to errors correctly. You can use make's -k
option to ignore them, but the error messages still go the same place as
other programs.

HTH,
-Arcege


--
There's so many different worlds,
So many different suns.
And we have just one world,
But we live in different ones.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20051012/7296fd68/attachment.htm


More information about the Tutor mailing list