Skip to content

CollectNukeWrites plugin fails for collection render targets if no frames/directory exist #282

Description

@sebastianbrandhuber

Is there an existing issue for this?

  • I have searched the existing issues and added correct labels.

Description

Current Behavior

The CollectNukeWrites plugin fails, if render target is either "frames" or "frames_farm" and either the directory or the frames inside an existing directory do not exist.

Expected Behavior

Should not fail at this stage of collection OR raise a descriptive PublishError.

Steps To Reproduce:

  1. Open Nuke, create a write instance but do not render.
  2. Set its render target to "Use existing frames" or "Use existing frames - farm".
  3. Publish fails with a FileNotFoundError because the directory does not exist -
    or might fail with an IndexError if the directory exists, but no files.

Additional context:

Version

ayon-nuke 0.4.10

What platform were you running when you found the bug?

Windows 11

I am not sure where this issue should be fixed first,
since a validator exists:
https://github.com/ynput/ayon-nuke/blob/develop/client/ayon_nuke/plugins/publish/validate_rendered_frames.py

This validator only validates existing representations, that might not exist yet for validation because the
Use existing frames - farm render target does not create one during local publish.

But even if using Use existing frames, the collect write plugin still fails, so the collector plugin needs to be fixed anyways to do a better error handling.

As an idea, we could either raise a PublishError directly in the collector,
or store the error information on the instance and raise the Error during validation in the
validate_rendered_frames plugin.

Relevant log output:

Traceback (most recent call last):
  File "C:\Users\brandhuber\AppData\Local\Ynput\AYON\dependency_packages\ayon_2602231726_windows.zip\dependencies\pyblish\plugin.py", line 528, in __explicit_process
    runner(*args)
  File "[dev]\ayon-nuke\client\ayon_nuke\plugins\publish\collect_writes.py", line 51, in process
    self._set_existing_files_data(instance, colorspace)
  File "[dev]\ayon-nuke\client\ayon_nuke\plugins\publish\collect_writes.py", line 76, in _set_existing_files_data
    collected_frames = self._get_collected_frames(instance)
  File "[dev]\ayon_nuke\plugins\publish\collect_writes.py", line 421, in _get_collected_frames
    for filename in os.listdir(output_dir)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'xxx/0001_010_comp_sbr'


Traceback (most recent call last):
  File "C:\Users\brandhuber\AppData\Local\Ynput\AYON\dependency_packages\ayon_2602231726_windows.zip\dependencies\pyblish\plugin.py", line 528, in __explicit_process
    runner(*args)
  File "[dev]\ayon-nuke\client\ayon_nuke\plugins\publish\collect_writes.py", line 51, in process
    self._set_existing_files_data(instance, colorspace)
  File "[dev]\ayon-nuke\client\ayon_nuke\plugins\publish\collect_writes.py", line 83, in _set_existing_files_data
    self.set_representation_colorspace(
  File "C:\Users\brandhuber\AppData\Local\Ynput\AYON\addons\core_1.9.7\ayon_core\pipeline\publish\publish_plugins.py", line 494, in set_representation_colorspace
    set_colorspace_data_to_representation(
  File "C:\Users\brandhuber\AppData\Local\Ynput\AYON\addons\core_1.9.7\ayon_core\pipeline\colorspace.py", line 1314, in set_colorspace_data_to_representation
    filename = filename[0]
IndexError: list index out of range

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions