本文整理汇总了Python中pyaid.file.FileUtils.FileUtils.emptyFolder方法的典型用法代码示例。如果您正苦于以下问题:Python FileUtils.emptyFolder方法的具体用法?Python FileUtils.emptyFolder怎么用?Python FileUtils.emptyFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyaid.file.FileUtils.FileUtils
的用法示例。
在下文中一共展示了FileUtils.emptyFolder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import emptyFolder [as 别名]
def run(self):
""" Executes the analysis process, iterating through each of the analysis stages before
cleaning up and exiting. """
print('[OUTPUT PATH]: %s' % self.analysisRootPath)
print(analysisStamp)
print(tracksStamp)
self._startTime = TimeUtils.getNowDatetime()
myRootPath = self.getPath(isDir=True)
if os.path.exists(myRootPath):
FileUtils.emptyFolder(myRootPath)
if not os.path.exists(myRootPath):
os.makedirs(myRootPath)
tempPath = self.tempPath
if os.path.exists(tempPath):
SystemUtils.remove(tempPath)
os.makedirs(tempPath)
if not self.logger.loggingPath:
self.logger.loggingPath = myRootPath
try:
session = self.getAnalysisSession()
self._preAnalyze()
for stage in self._stages:
self._currentStage = stage
stage.analyze()
self._currentStage = None
self._postAnalyze()
session.commit()
session.close()
self._success = True
except Exception as err:
session = self.getAnalysisSession()
session.close()
msg = [
'[ERROR]: Failed to execute analysis',
'STAGE: %s' % self._currentStage]
self._errorMessage = Logger.createErrorMessage(msg, err)
self.logger.writeError(msg, err)
session = self.getTracksSession()
session.close()
self._cleanup()
SystemUtils.remove(tempPath)
self.logger.write('\n\n[%s]: %s (%s)' % (
'SUCCESS' if self._success else 'FAILED',
self.__class__.__name__,
TimeUtils.toPrettyElapsedTime(self.elapsedTime)
), indent=False)