В определенный момент моего цикла while я запускаю os.listdir для индекса из трех элементов, чтобы создать список файлов, и получаю «Ошибка Windows 3 - Путь не существует», хотя ранее я вызывал этот путь в мой сценарий успешно
После этого я запустил файл os.path.exists, в котором говорится, что для первых двух циклов каталог оценивается как False, а в третьем - как True.
Я пытался использовать glob.glob, и он также возвращает файлы только в третьем цикле.
Проблема в цикле while в комментарии «создает узлы чтения на основе количества найденных снимков».
Буду признателен за любую помощь, чтобы прочитать его как True с самого начала, спасибо!
# Iterating using while loop, this gets every version folder for each shots' plates and stores to a "version" list
while shotIndex < shotAmountTotal:
nextShot = (shots[shotIndex])
shotIndex += 1
verSearchPath = shotSearchPath + '/' + nextShot + '/' + compFolder + '/' + platesFolder
foundVerList = os.listdir(verSearchPath)
verListCombined.append(foundVerList)
verListSorted = list(chain.from_iterable(verListCombined))
#this groups the like folder names, splits them at the underscore before the version number and then returns only the highest version number of each group
groupedShotFolders = groupby(verListSorted, key=lambda version: version.rsplit('_', 1)[0])
latestShotVer = [sorted(group, reverse=True)[0] for key, group in groupedShotFolders]
#creates Read nodes based on number of shots found
latestShotAmount = len(latestShotVer)
latestShotIndex = 0
while latestShotIndex < latestShotAmount:
latestShot = (latestShotVer[latestShotIndex])
frameListerPath = verSearchPath + '/' + latestShot + '/' + fileExtension + '/'
print os.path.exists(frameListerPath)
frameLister = os.listdir(verSearchPath + '/' + latestShot + '/' + fileExtension + '/')
Вывод терминала, который я получаю:
Result: False
E:/projects/MBR/shots/103/MRS_103_005_020/2d/plates/MRS_103_005_010_BG_001_v002/exr/
[]
False
E:/projects/MBR/shots/103/MRS_103_005_020/2d/plates/MRS_103_005_010_FG_001_v003/exr/
[]
True
E:/projects/MBR/shots/103/MRS_103_005_020/2d/plates/MRS_103_005_020_BG_001_v003/exr/
['E:/projects/MBR/shots/103/MRS_103_005_020/2d/plates/MRS_103_005_020_BG_001_v003/exr\\MRS_103_005_020_BG_001_v003.0999.exr', 'E:/projects/MBR/shots/103/MRS_103_005_020/2d/plates/MRS_103_005_020_BG_001_v003/exr\\MRS_103_005_020_BG_001_v003.1000.exr', 'E:/projects/MBR/shots/103/MRS_103_005_020/2d/plates/MRS_103_005_020_BG_001_v003/exr\\MRS_103_005_020_BG_001_v003.1001.exr', 'E:/projects/MBR/shots/103/MRS_103_005_020/2d/plates/MRS_103_005_020_BG_001_v003/exr\\MRS_103_005_020_BG_001_v003.1002.exr']