本文整理汇总了Python中FileSystem.FileSystem.getDataDir方法的典型用法代码示例。如果您正苦于以下问题:Python FileSystem.getDataDir方法的具体用法?Python FileSystem.getDataDir怎么用?Python FileSystem.getDataDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSystem.FileSystem
的用法示例。
在下文中一共展示了FileSystem.getDataDir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runner
# 需要导入模块: from FileSystem import FileSystem [as 别名]
# 或者: from FileSystem.FileSystem import getDataDir [as 别名]
def runner(self):
logging.info('MakeForumViewLogs.runner(), ' + self.currCourseName)
self.courseDatasetInfo = FileSystem.loadCourseDatasetInfo()
try:
if self.currCourseName not in self.courseDatasetInfo \
or self.courseDatasetInfo[self.currCourseName] is None:
print(self.currCourseName + ' has no activity log. Exiting...')
sys.exit()
print('Working on: ' + self.currCourseName + ' (' + self.progress() +')')
activityLogFileZipped = self.getActivityLogFile()
activityLogFileUnzipped = activityLogFileZipped[:-3]
outputDir = os.path.join(FileSystem.getDataDir(), 'ActivityLogsCoursera')
outputPath = os.path.join(outputDir, self.currCourseName + '.viewlog')
if os.path.exists(outputPath):
logging.info('Output file already exists: ' + outputPath)
sys.exit()
if os.path.exists(activityLogFileZipped):
self.unzip(activityLogFileZipped)
if not os.path.exists(activityLogFileUnzipped):
logging.info('Error finding file ' + activityLogFileUnzipped)
sys.exit()
views = self.getViews(activityLogFileUnzipped)
self.writeViews(views,outputPath)
self.zip(activityLogFileUnzipped)
except CourseDBError:
logging.info('\t\t+ ERROR (Connection does not exist), skipping...')
pass
except NoGradesError:
logging.info('\t\t+ ERROR (CourseGrades does not exist), skipping...')
pass
示例2: getActivityLogFile
# 需要导入模块: from FileSystem import FileSystem [as 别名]
# 或者: from FileSystem.FileSystem import getDataDir [as 别名]
def getActivityLogFile(self):
activityLogDir = os.path.join(FileSystem.getDataDir(),'ActivityLogsCoursera')
path = os.path.join(activityLogDir, \
self.courseDatasetInfo[self.currCourseName])
return path