-
Notifications
You must be signed in to change notification settings - Fork 354
Description
Using env.MY_VARIABLE to access a non-existent variable in one package causes a RexUndefinedVariableError. This is expected behavior and can be caught in a try / except block. However, if another unrelated package's logic accesses the env's values using env.values() or similar afterwards, a second RexUndefinedVariableError is raised in that package due to the access to the variable in the first package. Order of operation is crucial here, as this obviously does not occur if packageB is resolved before packageA.
Environment
- Linux Rocky 9 / macOS 15.7.1
- Rez version 3.3.0 and older
- Rez Python version 3.11.13 and older
To Reproduce
- Download the example packages.zip archive.
- Change directory into the extracted
packagesdirectory. - Execute:
REZ_PACKAGES_PATH=. rez-env packageA packageB
Expected behavior
No error should be thrown during packageB's commands execution, even though a non-existent variable was accessed in packageA's commands function earlier. The environment should resolve as expected.
Actual behavior
The environment fails to resolve due to the error.
Workaround
Use getenv("MY_VARIABLE") instead of env.MY_VARIABLE to get the variable value and check for existence.