import hashlib import fmeobjects def fileInfo(feature): log = fmeobjects.FMELogFile() try: dir = FME_MacroValues['SourceDirectory'] fileName = FME_MacroValues['SourceTileId'] file = dir + "\\\\" + fileName + ".TIF" digest = hashlib.md5(open(file, 'rb').read()).hexdigest() fileSize = os.path.getsize(file) >> 20 feature.setAttribute("actual_fileSize", fileSize) feature.setAttribute("actual_md5", digest) pass except Exception, e: log.logMessageString(str(e), fmeobjects.FME_ERROR)
Even though this works and we can test on the 2 attributes created we get the following errors:
Bridge failed to output feature on tag `PYOUTPUT' PythonFactory failed to process feature PythonFactory failed to process feature
and so the validation messages I want to get out are lost in the log.
Any ideas what I am doing wrong here?