def __getstate__(self):
        "Experimental pickling support."
        if self.__dict__['_parent']:
            raise PickleError(
                "Only root instances of %s can currently be pickled." % \
                type(self).__name__)
        tmp_filename = os.path.join(gettempdir(), "mlab_pickle_%s.mat" % self._mlabwrap._session)
        try:
            mlab.save(tmp_filename, self._name)
            mlab_contents = slurp(tmp_filename, binary=1)
        finally:
            if os.path.exists(tmp_filename): os.remove(tmp_filename)

        return {'mlab_contents' : mlab_contents,
                'name': self._name}
def __getstate__ ( self ) : if self . __dict__ [ '_parent' ] : raise PickleError ( "Only root instances of %s can currently be pickled." % type ( self ) . __name__ ) tmp_filename = os . path . join ( gettempdir ( ) , "mlab_pickle_%s.mat" % self . _mlabwrap . _session ) try : mlab . save ( tmp_filename , self . _name ) mlab_contents = slurp ( tmp_filename , binary = 1 ) finally : if os . path . exists ( tmp_filename ) : os . remove ( tmp_filename ) return { 'mlab_contents' : mlab_contents , 'name' : self . _name }
Experimental pickling support.