ERROR : <tuple_name> is not defined

 
 
 
 # ERROR : Traceback (most recent call last):
#   File "<Script Block >", line 12, in ?
#     blinn, prevsrc = surface.ConnectFromFile( "$SI_HOME\Data\DSPresets\Shaders\Material\Blinn.Preset", prevsrc )
# NameError: name 'prevsrc' is not defined
#  - [line 12]

Possible Cause

This is a message that can appear when you are trying to access a method's output arguments with tuple syntax but you have forgotten to initialize at least one of the variables you are using.

Suggested Solution

You can just assign 0 or "" to each variable just to initialize it before using, regardless of what type it will eventually be (see Getting Output Arguments from Methods for more information).