def _download_fired(self): if not os.path.exists(self.local_dir): os.makedirs(self.local_dir) try: s = SFTPServer(self.server_username, '', self.server_host) if hasattr(s, 'sftp'): s.download(os.path.join(self.server_dir, self.zip_filename), os.path.join(self.local_dir, self.zip_filename)) s.sftp.stat(os.path.join(self.server_dir, self.zip_filename)) s.close() except IOError, e: print e
def download_aramis_file(self, arkey): af = self.aramis_dict[arkey] af_rel_dir = os.path.join(self.relative_path, 'aramis') af_local_dir = os.path.join(simdb.simdb_cache_dir, af_rel_dir) if not os.path.exists(af_local_dir): os.makedirs(af_local_dir) try: s = SFTPServer(simdb.server_username, '', simdb.server_host) if hasattr(s, 'sftp'): zip_filename = af + '.zip' zipfile_server = os.path.join( simdb.simdb_cache_remote_dir, af_rel_dir, zip_filename) zipfile_server = string.replace(zipfile_server, '\\', '/') zipfile_local = os.path.join(af_local_dir, zip_filename) print 'downloading', zipfile_server print 'destination', zipfile_local s.download(zipfile_server, zipfile_local) s.sftp.stat(zipfile_server) s.close() except IOError, e: raise IOError(e)