#!/usr/bin/python # -*- coding: GBK -*- #------------------------------------------------------------------------------- # #------------------------------------------------------------------------------- # import os import os.path from Common import mylog from DBCommon import error def DumpData(root, subDir, fileName, data): filePath = os.path.join(root, subDir) if not os.path.exists(filePath): os.makedirs(filePath) fileFullName = os.path.join(filePath, fileName) try: saveFile = open(fileFullName, 'wb') #¸²¸Çʽ saveFile.write(data) except IOError, (errno, strerror): msg = error.formatMsg('error', error.ERROR_NO_37, 'I/O error(%s):%s fileName = %s'%(errno, strerror, fileFullName)) mylog.error(msg) except: msg = error.formatMsg('error', error.ERROR_NO_38, 'DumpData!fileName = %s'%fileFullName) mylog.error(msg) else: saveFile.close()