getavalon / core

The safe post-production pipeline - https://getavalon.github.io/2.0
MIT License
218 stars 49 forks source link

Resilience against missing paths #422

Open mottosso opened 5 years ago

mottosso commented 5 years ago

What happened? When project is set, but no project files exists, odd errors start appearing.

#   File "C:\Users\marcus\packages\avalon_core\5.3.2\python\avalon\pipeline.py", line 1082, in load
#     return loader.load(context, name, namespace, options)
#   File "<string>", line 124, in load
# RuntimeError: No file name given.

On trying to load an asset. (Yes I did give you a file name!)

#   File "<string>", line 29, in copy_path_to_clipboard
#   File "C:\program files\autodesk\maya2018\bin\python27.zip\ntpath.py", line 419, in normpath
# AttributeError: 'NoneType' object has no attribute 'startswith'

On trying to copy that asset's path. (I wanted Bruce's model, what is a NoneType??)

What did you expect? A warning or help message about what to do. Avalon can't make assumptions about where files are located, as users may be remote, disks may be unmounted or paths may not be cross-platform. The end-user is able to act on those, but can't do much with a stack trace.

To Reproduce Set these variables, but leave an invalid AVALON_PROJECTS.

Additional context I ran into this whilst locally testing Avalon and moving files around on disk. It's not expected to be common, but there isn't much required for it to be handled appropriately.

Also linking to #371 here, as it introduced a mechanism that doesn't return a path unless the path is found on disk; even though a path was available relative the representation/config.