I have a working workspace which has 4 writers in it (PDF, CSV, CSV, SHP). They currently all write to a single zip file.
However, what I'd like is for three of the writers to also write a copy of the data to somewhere else (not the zip file).
Obviously I can just create 3 more writers and plug them in next to the zip-ones, but I was wondering if there was a more elegant solution.
Notions I've had so far:
- Shutdown Python to uncompress/compress stuff. Seems a bit heavy.
- A file writer/copier but I'll need a lot of pipework to figure out filenames etc.
- 3 new writers.
- Add a second directory in the DestDirectory parameter (delimited with a comma). FME errored out.
Any other notions? Ideally the last one works but I'm doing it wrong.
Thanks,
Jonathan
Best answer by takashi
Hi Jonathan,
I would add this notion.
- Create another workspace with a WorkspaceRunner to run the original workspace twice. i.e. zip-compression mode, and other output mode.
But I don't think that the Shutdown Python Script approach is so heavy. After getting zip file path and destination folder path from corresponding parameters, this script, for example, decompress the zip and save the extracted files into the specified folder.
----
if FME_Status == 1:
from zipfile import ZipFile
zip = ZipFile(zip_file_path, 'r')
zip.extractall(destination_folder_path)
zip.close()
----
The ZipFile module can be imported in standard FME installation.
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.
- Create another workspace with a WorkspaceRunner to run the original workspace twice. i.e. zip-compression mode, and other output mode.
But I don't think that the Shutdown Python Script approach is so heavy. After getting zip file path and destination folder path from corresponding parameters, this script, for example, decompress the zip and save the extracted files into the specified folder.
----
if FME_Status == 1:
from zipfile import ZipFile
zip = ZipFile(zip_file_path, 'r')
zip.extractall(destination_folder_path)
zip.close()
----
The ZipFile module can be imported in standard FME installation.
Thanks. I ended up going down the python route, I prefer your method of extracting from the zip over the one where Python puts them into the zip I think.
Although it turns out - while this works great in FME Desktop, it doesn't work so well in Server. And it's not clear why because FME Server doesn't seem to print anything from Python to the logs. So I know it failed, but not why it failed. :-/
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.