mailr28066 - /trunk/pipe_control/relax_data.py


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

Header


Content

Posted by edward on October 20, 2015 - 09:23:
Author: bugman
Date: Tue Oct 20 09:23:50 2015
New Revision: 28066

URL: http://svn.gna.org/viewcvs/relax?rev=28066&view=rev
Log:
Fix for bug #23933 (https://gna.org/bugs/?23933).

This is the "NameError: global name 'ids' is not defined" problem when 
loading relaxation data.

The bug was introduced back in November 2014 (r26588), and is due to some 
incomplete error handling
code.  The problem is that the spin type that the relaxation data belongs to 
(@N vs. @H) has not
been specified.  Now the correct RelaxMultiSpinIDError is raised.  The 'ids' 
variable did not exist
- it was code that was planned to be added, but never was and was forgotten.


Modified:
    trunk/pipe_control/relax_data.py

Modified: trunk/pipe_control/relax_data.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/relax_data.py?rev=28066&r1=28065&r2=28066&view=diff
==============================================================================
--- trunk/pipe_control/relax_data.py    (original)
+++ trunk/pipe_control/relax_data.py    Tue Oct 20 09:23:50 2015
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2003-2014 Edward d'Auvergne                                  
 #
+# Copyright (C) 2003-2015 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
 #                                                                            
 #
@@ -762,12 +762,17 @@
         if len(spins) == 0:
             continue
 
-        # Check that only a singe spin is present.
+        # Check that multiple spins are not present.
         if len(spins) > 1:
-            if ids:
-                raise RelaxMultiSpinIDError(spin_ids[i], ids)
-            else:
-                raise RelaxMultiSpinIDError(spin_ids[i], ids)
+            # Generate the list of spin IDs.
+            new_ids = []
+            for j in range(len(spins)):
+                
new_ids.append(generate_spin_id_unique(mol_name=match_mol_names[j], 
res_num=match_res_nums[j], res_name=match_res_names[j], 
spin_num=spins[j].num, spin_name=spins[j].name))
+
+            # Raise the error.
+            raise RelaxMultiSpinIDError(spin_ids[i], new_ids)
+
+        # Check that at least one spin is present.
         if len(spins) == 0:
             raise RelaxNoSpinError(spin_ids[i])
 




Related Messages


Powered by MHonArc, Updated Tue Oct 20 09:40:14 2015