Author: bugman Date: Fri Nov 28 09:34:02 2014 New Revision: 26798 URL: http://svn.gna.org/viewcvs/relax?rev=26798&view=rev Log: Bug fix for the pymol.view user function for when no PDB file exists. The pymol.view user function would fail with an AttributeError when the currently loaded data does not exist as a PDB file. This is now caught and the non-existent PDB is no longer displayed. A better solution might be to dump all the current structural data into a temporary file and load that, all within a try-finally statement to be sure to delete the temporary file. This solution may not be what the user is interested in anyway. Modified: trunk/pipe_control/pymol_control.py Modified: trunk/pipe_control/pymol_control.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/pymol_control.py?rev=26798&r1=26797&r2=26798&view=diff ============================================================================== --- trunk/pipe_control/pymol_control.py (original) +++ trunk/pipe_control/pymol_control.py Fri Nov 28 09:34:02 2014 @@ -34,9 +34,11 @@ from subprocess import PIPE, Popen from tempfile import mktemp from time import sleep +from warnings import warn # relax module imports. from lib.errors import RelaxError, RelaxNoPdbError, RelaxNoSequenceError +from lib.warnings import RelaxWarning from lib.io import delete, file_root, get_file_path, open_read_file, open_write_file, test_binary from pipe_control.mol_res_spin import exists_mol_res_spin_data from pipe_control.pipes import check_pipe @@ -144,6 +146,11 @@ open_files = [] for model in cdp.structure.structural_data: for mol in model.mol: + # No file path. + if not hasattr(mol, 'file_name'): + warn(RelaxWarning("Cannot display the current molecular data in PyMOL as it has not be exported as a PDB file.")) + continue + # The file path as the current directory. file_path = None if access(mol.file_name, F_OK):