try...else...except syntax error
- by iform
I can't understand this...
Cannot get this code to run and I've no idea why it is a syntax error.
try:
newT.read()
#existingArtist = newT['Exif.Image.Artist'].value
#existingKeywords = newT['Xmp.dc.subject'].value
except KeyError:
print "KeyError"
else:
#Program will NOT remove existing values
newT.read()
if existingArtist != "" :
newT['Exif.Image.Artist'] = artistString
print existingKeywords
keywords = os.path.normpath(relativePath).split(os.sep)
print keywords
newT['Xmp.dc.subject'] = existingKeywords + keywords
newT.write()
except:
print "Cannot write tags to ",filePath
Syntax error occurs on the last "except:". Again...I have no idea why python is throwing a syntax error (spent ~3hrs on this problem).