<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Jan 10, 2012, at 10:05 AM, divya neelagiri wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hello,</div><div> </div><div>I am using python to go through all the files in a directory and minimize them using chimera. But the problem is I get and error when I try to minimize a file having Br. I have a lot of files in that directory. So is there any way by which I can skip the file that has error and go onto the next file? Any suggestion would br greatly appreciated.</div></blockquote><br></div><div>Hi Divya,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>You can deal with possible errors using Python's try/except error-handling construct. Something like:</div><div><br></div><div><initial script code></div><div> for <each file>:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span><initial loop code></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>try:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span><code that might produce an error></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>except:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span><things you want to do if there's an error></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>continue</div><div><span class="Apple-tab-span" style="white-space:pre"> </span><things you want to do if there's no error></div><div><final script code></div><div><br></div><div>Check out this part of the Python tutorial about error handling:</div><div><br></div><div><a href="http://docs.python.org/tutorial/errors.html#handling-exceptions">http://docs.python.org/tutorial/errors.html#handling-exceptions</a></div><div><br></div><div>--Eric</div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="5" style="font: 16.0px Helvetica"><span class="Apple-converted-space"> <span class="Apple-converted-space"> </span></span>Eric Pettersen</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="5" style="font: 16.0px Helvetica"><span class="Apple-converted-space"> <span class="Apple-converted-space"> </span></span>UCSF Computer Graphics Lab</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="5" style="font: 16.0px Helvetica"><span class="Apple-converted-space"> </span><a href="http://www.cgl.ucsf.edu">http://www.cgl.ucsf.edu</a></font></p><br class="Apple-interchange-newline"></div></span> </div><br></body></html>