Question

file path as published parameter for Dynamic Input Reader


Badge
Hello all , 

 

 

I am trying to read all the file paths from a text file which is going to be the source file paths for the dynamic reader . I am using below private variable to generate the source reader's path

 

 

# Get the file from a published parameter

 

ListFile = (FME_MacroValues['Config_File'])

 

f = open(ListFile,'r')

 

featureTypes = ''

 

# Read the file and add each line to the featureTypes Variable

 

featureTypes = f.read()

 

f.close()

 

#Return this list to the parameter

 

return featureTypes

 

 

And I am publishing it to FME Server . When I run the job I am getting error saying it cannot read "C:\\temp1 C:\\temp2 C:\\temp3" .

 

 

Any suggestions ??? 

3 replies

Badge +3
Do you feed it individually qouted file/paths?

 

might this be the cause?
Badge
Hello Gio, 

 

 

Yes I tried and that worked

 

 

but how can I do the same using python ? 
Userlevel 2
Badge +17
correction for indentations.

 

-----

 

f = open(ListFile, 'r')

 

featureTypes = []

 

for s in f.readlines():

 

    featureTypes.append('"%s"' % s.strip())

 

featureTypes = ' '.join(featureTypes)

 

-----

Reply