[GIS] Unzip a file using python caller in FME 2011

fmepython

The idea is to download a zipped file from a website and unzip it using FME 2011. I have attached a screenshot of FME workbench which is not working.

FME Workbench

Best Answer

Your code seems incorrect. Try:

import pyfme, os, zipfile
z = zipfile.ZipFile("GoTransitDL.zip")
z.extractall()

And just as a warning (from API docs):

Warning Never extract archives from untrusted sources without prior inspection. It is possible that files are created outside of path, e.g. members that have absolute filenames starting with "/" or filenames with two dots "..".

The zip file can be made to extract files to anywhere on your hard drive, and z.extractall() will oblige. Very dangerous if you don't know the source.