Esempio n. 1
0
def load_session(v, filename, state):
    D = {}
    for k, x in v.iteritems():
        try:
            _ = loads(dumps(x))
        except (IOError, TypeError):
            print "Unable to save %s" % k
        else:
            D[k] = x
    print "Saving variables to %s" % filename
    save(D, filename)
Esempio n. 2
0
def load_session(v, filename, state):
    D = {}
    for k, x in v.iteritems():
        try:
            _ = loads(dumps(x))
        except (IOError, TypeError):
            print "Unable to save %s"%k
        else:
            D[k] = x
    print "Saving variables to %s"%filename
    save(D, filename)
Esempio n. 3
0
def save_session(filename):
    D = {}
    v = variables(with_types=False)
    for k in v:
        x = sage_globals[k]
        try:
            _ = loads(dumps(x))
        except (IOError, TypeError, PicklingError):
            if k != 'fortran':  # this is a hack to get around the inline fortran object being
                # *incredibly* hackish in how it is implemented; the right
                # fix is to rewrite the fortran inline to *not* be so incredibly
                # hackish.  See trac #2891.
                print "Unable to save %s" % k
        else:
            D[k] = x
    print "Saving variables to object %s.sobj" % filename
    save(D, filename)
Esempio n. 4
0
def save_session(filename):
    D = {}
    v = variables(with_types=False)
    for k in v:
        x = sage_globals[k]
        try:
            _ = loads(dumps(x))
        except (IOError, TypeError, PicklingError):
            if k != 'fortran':  # this is a hack to get around the inline fortran object being
                                # *incredibly* hackish in how it is implemented; the right
                                # fix is to rewrite the fortran inline to *not* be so incredibly
                                # hackish.  See trac #2891.
                print "Unable to save %s"%k
        else:
            D[k] = x
    print "Saving variables to object %s.sobj"%filename
    save(D, filename)