Question

shutdown python to move writer file


Badge
Hi All,

 

I need to retrieve a path of writer to remove this writer file from its directory to another one. I couldn't retrive the writer path using Shutdown Python Script.

 

 

Example :

 

    src_file = "c://temp/file1.csv"

 

     dst_file = feature.getAttribute("fme_basename")  ??

 

    

 

      shutil.move(src_file, dst_file)

 

   

 

 

I can't retrive feature into my script !

 

 

 

Any idea?

 

Thanks an advance.

 

 

Farfar

3 replies

Userlevel 4
Hi,

 

 

the shutdown script is executed once all the features have been written, so you cannot reference feature attributes there (there are no features anymore)

 

 

You can, however, reference published parameters through the FME_MacroValues dictionary, like this:

 

 

dst_file = FME_MacroValues['Your_published_parameter_name_here']

 

 

David
Badge
Hi David,

 

The problem is how could i retrieve a writer file name and save it as published parameter? 

 

 

My idea is to move a result file (writer) from its folder to another folder, so i need its name to do this moved into shutdown script. 

 

 

Thanks an advance;

 

FarFar
Userlevel 4
Hi,

 

 

all reader and writer filenames are automatically mirrored as published parameters:

 

 

 

 

For the above filename you would write the followingt:

 

 

dst_file = FME_MacroValues['SourceDataset_SHAPE']

 

 

David

Reply