mailr17610 - /trunk/relax_io.py


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

Header


Content

Posted by edward on September 28, 2012 - 18:34:
Author: bugman
Date: Fri Sep 28 18:34:49 2012
New Revision: 17610

URL: http://svn.gna.org/viewcvs/relax?rev=17610&view=rev
Log:
Python 3 preparations - error handling is now Python 2 and 3 compatible in 
the relax_io module.


Modified:
    trunk/relax_io.py

Modified: trunk/relax_io.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/relax_io.py?rev=17610&r1=17609&r2=17610&view=diff
==============================================================================
--- trunk/relax_io.py (original)
+++ trunk/relax_io.py Fri Sep 28 18:34:49 2012
@@ -358,7 +358,8 @@
                 raise RelaxError("Cannot open the file " + repr(file_path) + 
", try uncompressing first.  " + dep_check.bz2_module_message + ".")
         elif compress_type == 2:
             file_obj = GzipFile(file_path, 'r')
-    except IOError, message:
+    except IOError:
+        message = sys.exc_info()[1]
         raise RelaxError("Cannot open the file " + repr(file_path) + ".  " + 
message.args[1] + ".")
 
     # Return the opened file.
@@ -454,7 +455,8 @@
             file_obj = BZ2File(file_path, 'w')
         elif compress_type == 2:
             file_obj = GzipFile(file_path, 'w')
-    except IOError, message:
+    except IOError:
+        message = sys.exc_info()[1]
         raise RelaxError("Cannot open the file " + repr(file_path) + ".  " + 
message.args[1] + ".")
 
     # Return the opened file.
@@ -508,9 +510,9 @@
     col_arg_names = ['spin_id_col', 'mol_name_col', 'res_name_col', 
'res_num_col', 'spin_name_col', 'spin_num_col', 'data_col', 'error_col']
     for i in range(len(col_args)):
         if col_args[i] == 0:
-            raise RelaxError, "The '%s' argument cannot be zero, column 
numbering starts at one." % col_arg_names[i]
+            raise RelaxError("The '%s' argument cannot be zero, column 
numbering starts at one." % col_arg_names[i])
     if spin_id_col and (mol_name_col or res_name_col or res_num_col or 
spin_name_col or spin_num_col):
-        raise RelaxError, "If the 'spin_id_col' argument has been supplied, 
then the mol_name_col, res_name_col, res_num_col, spin_name_col, and 
spin_num_col must all be set to None."
+        raise RelaxError("If the 'spin_id_col' argument has been supplied, 
then the mol_name_col, res_name_col, res_num_col, spin_name_col, and 
spin_num_col must all be set to None.")
 
     # Minimum number of columns.
     min_col_num = max(spin_id_col, mol_name_col, res_num_col, res_name_col, 
spin_num_col, spin_name_col, data_col, error_col)




Related Messages


Powered by MHonArc, Updated Fri Sep 28 19:00:02 2012