Author: bugman Date: Fri Sep 26 18:27:59 2008 New Revision: 7361 URL: http://svn.gna.org/viewcvs/relax?rev=7361&view=rev Log: Updated the from_xml() to check the path and current directory for the structure. A warning is raised if the file cannot be found. Modified: 1.3/generic_fns/structure/api_base.py Modified: 1.3/generic_fns/structure/api_base.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/api_base.py?rev=7361&r1=7360&r2=7361&view=diff ============================================================================== --- 1.3/generic_fns/structure/api_base.py (original) +++ 1.3/generic_fns/structure/api_base.py Fri Sep 26 18:27:59 2008 @@ -29,11 +29,14 @@ """ # Python module imports. +from os import sep from types import MethodType +from warnings import warn # relax module import. from data.relax_xml import fill_object_contents, xml_to_object -from relax_errors import RelaxImplementError +from relax_errors import RelaxFileError, RelaxImplementError +from relax_warnings import RelaxWarning class Base_struct_API: @@ -225,7 +228,23 @@ xml_to_object(str_node, self) # Now load the structure from file again. - self.load_pdb(file_path=self.file[0], model=None) + failed = False + try: + self.load_pdb(file_path=self.path[0] + sep + self.file[0], model=None) + except RelaxFileError: + failed = True + + # Now load the structure from file again. + if failed: + failed = False + try: + self.load_pdb(file_path=self.path[0] + sep + self.file[0], model=None) + except RelaxFileError: + failed = True + + # Can't load the file. + if failed: + warn(RelaxWarning("The structure file " + `self.file[0]` + " cannot be found in the current directory or in " + `self.path[0]` + ". No data will be loaded.")) def load_pdb(self, file_path, model=None, verbosity=False):