I wrote a hyperlink script in Python for the Display tab. It has an if/elif structure based on the value of a field. With just the if clause, it runs fine an opens the document. But when I add the elif clause, Arc gives me an error saying '...name OpenLink is not defined'. This makes no sense to me, it's the default name of the function. Any ideas? Thanks.
Code:
import os, threading
def OpenLink ([SubtypeCD], [Name] ):
if [SubtypeCD] == 'Recorded' and [Name] is not None:
parsedName = [Name].partition('-')
folderPrefix = parsedName[0].zfill(4)
fileSuffix = parsedName[2].zfill(4)
extension = '.TIF'
fileName = folderPrefix + fileSuffix + extension
loc = r"\\base\path"
image = os.path.join(loc, folderPrefix, fileName)
threading.Thread(target=os.startfile, args=(image,)).start()
elif [SubtypeCD] == 'Unrecorded' and [Name] is not None:
parsedName =[Name].split('-')
folderOne = parsedName[0] + '_Survey'
folderTwo = [Name]
fileName = [Name] + '0001.tif'
loc = r"\\other\base\path'
image = os.path.join(loc, folderOne, folderTwo, fileName)
threading.Thread(target=os.startfile, args=(image,)).start()
else:
pass
return