Backing up, how much of a failure do you want? Do you want this thing to messily grind to a halt, or do you want it to try to deal with the error somewhat gracefully?<br><br>If pip failing to install a dependency is a massive deal-breaker for the whole system, which, further, you never really expect to happen, but you don't want it to fail silently, use an assert.<br>
<br>If pip failing to install a dependency is a rare error, but you need to clean up after yourself at a higher level before shutting down, then throw an exception, and catch it upstream.<br><br>Finally, if pip failing is an expected part of the program flow, and there are ways to gracefully handle the error, and continue processing, then check pip's return status (or catch it if it's an exception), do whatever, and continue processing.<br>
<br>Any of these strategies can be implemented with either pip returning a status code, or with pip throwing an exception. It's what you do with it that really matters.<br><br>-rose<br><br><div class="gmail_quote">On Wed, Feb 10, 2010 at 11:14 AM, C. Titus Brown <span dir="ltr"><<a href="mailto:ctb@msu.edu">ctb@msu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">subprocess returncode/status code == 0 => success<br>
<div><div></div><div class="h5"><br>
On Wed, Feb 10, 2010 at 11:13:20AM -0500, Rosangela Canino-Koning wrote:<br>
> Asserts are typically the preferred method for this. What kind of error does<br>
> pip return (or throw?) if it fails to install?<br>
><br>
> -rose<br>
><br>
> On Wed, Feb 10, 2010 at 10:50 AM, Max Laite <<a href="mailto:mlaite@gmail.com">mlaite@gmail.com</a>> wrote:<br>
><br>
> > I been thinking on some stuff to make virtualenv fail if pip can not<br>
> > install a dep. I have a few ideas, but the easiest would be to use a simple<br>
> > try block. I wanted to pass it by you guys to see if I am missing something<br>
> > in my thought process behind this.<br>
> ><br>
> > The other way was to catch the output from pip and parse for failed or<br>
> > something like that.<br>
> ><br>
> > Max<br>
> ><br>
> > _______________________________________________<br>
> > pony-build mailing list<br>
> > <a href="mailto:pony-build@lists.idyll.org">pony-build@lists.idyll.org</a><br>
> > <a href="http://lists.idyll.org/listinfo/pony-build" target="_blank">http://lists.idyll.org/listinfo/pony-build</a><br>
> ><br>
> ><br>
<br>
> _______________________________________________<br>
> pony-build mailing list<br>
> <a href="mailto:pony-build@lists.idyll.org">pony-build@lists.idyll.org</a><br>
> <a href="http://lists.idyll.org/listinfo/pony-build" target="_blank">http://lists.idyll.org/listinfo/pony-build</a><br>
<br>
<br>
</div></div><font color="#888888">--<br>
C. Titus Brown, <a href="mailto:ctb@msu.edu">ctb@msu.edu</a><br>
</font></blockquote></div><br>