Skip to main content
Question

shutdown python to move writer file


farfar
Contributor
Forum|alt.badge.img+11
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

david_r
Evangelist
  • June 4, 2014
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

farfar
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • June 4, 2014
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

david_r
Evangelist
  • June 4, 2014
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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings