-1
我試圖找到最後創建的文件夾名稱,使用python:沒有這樣的文件或目錄的錯誤使用getctime()
directory = mx.get_env('WORKDIR')+'/Benchmarks/SPECjvm2008/SPECjvm2008/results/'
folders = os.walk(directory).next()[1]
creation_times = [(folder, os.path.getctime(folder)) for folder in folders]
creation_times.sort(key=lambda x: x[1]) # sort by creation time
但我收到以下錯誤:
File "/home/taleporos/.jenkins/workspace/MaxineBench/graal/mxtool/mx.py", line 3588, in <module>
main()
File "/home/taleporos/.jenkins/workspace/MaxineBench/graal/mxtool/mx.py", line 3577, in main
retcode = c(command_args)
File "/home/taleporos/.jenkins/workspace/MaxineBench/maxine/mxmaxine/commands.py", line 432, in specjvmregression
dirfinder('specjvm')
File "/home/taleporos/.jenkins/workspace/MaxineBench/maxine/mxmaxine/commands.py", line 394, in dirfinder
print 'Folder: ', [(folder, os.path.getctime(folder)) for folder in folders]
File "/usr/lib/python2.7/genericpath.py", line 72, in getctime
return os.stat(filename).st_ctime
OSError: [Errno 2] No such file or directory: 'SPECjvm2008.002'
使用絕對路徑。 – aristotll
'os.path.getctime(文件夾)' - >'os.path.getctime(目錄+文件夾)' – DyZ
錯誤消息不包含您顯示的任何代碼行。 – martineau