I want to use the PythonCaller to read a value from the header of an ECW file.
The value I am looking for is four characters long, starting at the position of 37.
I want to then print the value.
This is the code I have so far;
import fme
import fmeobjects
# Template Function interface:
# When using this function, make sure its name is set as the value of
# the 'Class or Function to Process Features' transformer parameter
def processFeature(feature):
pass
# Template Class Interface:
# When using this class, make sure its name is set as the value of
# the 'Class or Function to Process Features' transformer parameter
class FeatureProcessor(object):
def __init__(self):
pass
def input(self,feature):
print ('start')
n = feature.getAttribute('fme_dataset')
print (n)
f = open(n,'rb')
f.seek(37,0)
print(f.read(4))
f.close()
self.pyoutput(feature)
print ('finish')
def close(self):
pass
But it does not return the value that I am expecting