mailr17607 - in /trunk: generic_fns/state.py relax_errors.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:11:
Author: bugman
Date: Fri Sep 28 18:11:48 2012
New Revision: 17607

URL: http://svn.gna.org/viewcvs/relax?rev=17607&view=rev
Log:
Python 3 preparations - compatibility for both the Python 2 cPickle and 
Python 3 pickle modules.


Modified:
    trunk/generic_fns/state.py
    trunk/relax_errors.py

Modified: trunk/generic_fns/state.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/generic_fns/state.py?rev=17607&r1=17606&r2=17607&view=diff
==============================================================================
--- trunk/generic_fns/state.py (original)
+++ trunk/generic_fns/state.py Fri Sep 28 18:11:48 2012
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2003-2011 Edward d'Auvergne                                  
 #
+# Copyright (C) 2003-2012 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
 #                                                                            
 #
@@ -23,7 +23,10 @@
 """Module for reading and writing the relax program state."""
 
 # Python module imports.
-from cPickle import dump, load
+try:
+    from cPickle import dump, load    # Python 2 import.
+except ImportError:
+    from pickle import dump, load    # Python 3 import.
 from re import search
 
 # relax module imports.

Modified: trunk/relax_errors.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/relax_errors.py?rev=17607&r1=17606&r2=17607&view=diff
==============================================================================
--- trunk/relax_errors.py (original)
+++ trunk/relax_errors.py Fri Sep 28 18:11:48 2012
@@ -29,7 +29,10 @@
     bz2 = True
 except ImportError:
     bz2 = False
-from cPickle import dump
+try:
+    from cPickle import dump    # Python 2 import.
+except ImportError:
+    from pickle import dump    # Python 3 import.
 from re import match
 import sys
 import time




Related Messages


Powered by MHonArc, Updated Fri Sep 28 18:40:01 2012