mailr9225 - /1.3/generic_fns/structure/scientific.py


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

Header


Content

Posted by edward on July 14, 2009 - 14:10:
Author: bugman
Date: Tue Jul 14 14:10:30 2009
New Revision: 9225

URL: http://svn.gna.org/viewcvs/relax?rev=9225&view=rev
Log:
Improvements for the reload_pdb() method.

Now the system path is searched for the PDB file.  This allows the system 
tests to pass when not
running from the installation path.


Modified:
    1.3/generic_fns/structure/scientific.py

Modified: 1.3/generic_fns/structure/scientific.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/scientific.py?rev=9225&r1=9224&r2=9225&view=diff
==============================================================================
--- 1.3/generic_fns/structure/scientific.py (original)
+++ 1.3/generic_fns/structure/scientific.py Tue Jul 14 14:10:30 2009
@@ -33,6 +33,7 @@
 from os import F_OK, access, sep
 if dep_check.scientific_pdb_module:
     import Scientific.IO.PDB
+import sys
 from warnings import warn
 
 # relax module imports.
@@ -681,8 +682,20 @@
 
         # Test if the file exists.
         if not access(file_path, F_OK):
-            warn(RelaxNoPDBFileWarning(file_path))
-            return
+            found = False
+
+            # Try finding the file in the path.
+            for dir in sys.path:
+                if access(dir + sep + file_path, F_OK):
+                    # Prepend the file path, and break out.
+                    file_path = dir + sep + file_path
+                    found = True
+                    break
+
+            # Throw a warning, then exit the function.
+            if not found:
+                warn(RelaxNoPDBFileWarning(file_path))
+                return
 
         # Load the PDB file.
         model = Scientific.IO.PDB.Structure(file_path, self.file_model)




Related Messages


Powered by MHonArc, Updated Tue Jul 14 14:20:03 2009