On Jan 10, 2012, at 10:05 AM, divya neelagiri wrote:

Hello,
 
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.

Hi Divya,
You can deal with possible errors using Python's try/except error-handling construct.  Something like:

<initial script code>
 for <each file>:
<initial loop code>
try:
<code that might produce an error>
except:
<things you want to do if there's an error>
continue
<things you want to do if there's no error>
<final script code>

Check out this part of the Python tutorial about error handling:

http://docs.python.org/tutorial/errors.html#handling-exceptions

--Eric

                        Eric Pettersen

                        UCSF Computer Graphics Lab

                        http://www.cgl.ucsf.edu