Changeset 23719


Ignore:
Timestamp:
02/13/19 04:45:30 (6 years ago)
Author:
bdef
Message:

BUG:fixing an import incompatibility

Location:
issm/trunk-jpl/src/m
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/organizer.py

    r23716 r23719  
    66from savevars import savevars
    77from model import model
    8 from dbm.ndbm import whichdb
     8#hack to keep python 2 compatipility
     9try:
     10        #py3 import
     11        from dbm.ndbm import whichdb
     12except ImportError:
     13        #py2 import
     14        from whichdb import whichdb
     15
    916import MatlabFuncs as m
    1017
     
    5562                #Get steps
    5663                self.requestedsteps=options.getfieldvalue('steps',[0])
    57                
     64
    5865                #Get trunk prefix (only if provided by user)
    5966                if options.exist('trunkprefix'):
     
    131138                        raise TypeError("Step provided should not have any white space")
    132139                if self._currentstep>0 and string in [step['string'] for step in self.steps]:
    133                         raise RuntimeError("Step '%s' already present. Change name" % string) 
     140                        raise RuntimeError("Step '%s' already present. Change name" % string)
    134141
    135142                #Add step
     
    139146                self._currentstep+=1
    140147
    141                 #if requestedsteps = 0, print all steps in self 
     148                #if requestedsteps = 0, print all steps in self
    142149                if 0 in self.requestedsteps:
    143150                        if self._currentstep==1:
  • issm/trunk-jpl/src/m/io/loadmodel.py

    r23716 r23719  
    11from loadvars import loadvars
    2 from dbm.ndbm import whichdb
     2#hack to keep python 2 compatipility
     3try:
     4        #py3 import
     5        from dbm.ndbm import whichdb
     6except ImportError:
     7        #py2 import
     8        from whichdb import whichdb
    39from netCDF4 import Dataset
    410
     
    814
    915           check that model prototype has not changed. if so, adapt to new model prototype.
    10        
     16
    1117           Usage:
    1218              md=loadmodel(path)
  • issm/trunk-jpl/src/m/io/loadvars.py

    r23716 r23719  
    77from os import path
    88from collections import OrderedDict
    9 from dbm.ndbm import whichdb
    109from model import *
     10#hack to keep python 2 compatipility
     11try:
     12        #py3 import
     13        from dbm.ndbm import whichdb
     14except ImportError:
     15        #py2 import
     16        from whichdb import whichdb
    1117
    1218def loadvars(*args):
Note: See TracChangeset for help on using the changeset viewer.