[Chimera-users] minimization using python

Eric Pettersen pett at cgl.ucsf.edu
Tue Jan 10 11:24:19 PST 2012


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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20120110/92037b7d/attachment.html>


More information about the Chimera-users mailing list