mailr6313 - /1.3/generic_fns/vmd.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on June 03, 2008 - 22:14:
Author: bugman
Date: Tue Jun  3 22:14:51 2008
New Revision: 6313

URL: http://svn.gna.org/viewcvs/relax?rev=6313&view=rev
Log:
Added checks for the Scientific.Visualization.VMD import (because it requires 
Numeric).


Modified:
    1.3/generic_fns/vmd.py

Modified: 1.3/generic_fns/vmd.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/vmd.py?rev=6313&r1=6312&r2=6313&view=diff
==============================================================================
--- 1.3/generic_fns/vmd.py (original)
+++ 1.3/generic_fns/vmd.py Tue Jun  3 22:14:51 2008
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2003-2004, 2007 Edward d'Auvergne                            
 #
+# Copyright (C) 2003-2004, 2007-2008 Edward d'Auvergne                       
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -21,7 +21,11 @@
 
###############################################################################
 
 # Python module imports.
-from Scientific.Visualization import VMD
+module_avail = False
+try:
+    from Scientific.Visualization import VMD    # This requires Numeric to 
be installed (at least in Scientific 2.7.8).
+except ImportError:
+    module_avail = False
 
 # relax module imports.
 from data import Relax_data_store; ds = Relax_data_store()
@@ -42,6 +46,11 @@
     def view(self, run):
         """Function for viewing the collection of molecules using VMD."""
 
+        # Test if the module is available.
+        if not module_avail:
+            print "VMD is not available (cannot import 
Scientific.Visualization.VMD due to missing Numeric dependency)."
+            return
+
         # Test if the PDB file has been loaded.
         if not ds.pdb.has_key(run):
             raise RelaxNoPdbError, run




Related Messages


Powered by MHonArc, Updated Wed Jun 04 01:00:12 2008