Skip to content

Commit

Permalink
Merge pull request #70 from fsteggink/gfs_remove_check
Browse files Browse the repository at this point in the history
Added extra check if GFS file can be removed to fix NLExtract issue 226
  • Loading branch information
justb4 committed Feb 28, 2018
2 parents d50832b + 2bb765f commit 755d449
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions stetl/outputs/execoutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,16 @@ def execute(self, ogr2ogr_cmd, file_path):
# the same base name
# Copy the .gfs file if required, use the same base name
# so ogr2ogr will pick it up.
gfs_path = None
# Always assemble the GFS path, in case it is provided from outside.
file_ext = os.path.splitext(file_path)
gfs_path = file_ext[0] + '.gfs'
if self.gfs_template:
file_ext = os.path.splitext(file_path)
gfs_path = file_ext[0] + '.gfs'
shutil.copy(self.gfs_template, gfs_path)

# Append file name to command as last argument
self.execute_cmd(ogr2ogr_cmd + ' ' + file_path)

if self.cleanup_input:
os.remove(file_path)
if gfs_path:
if gfs_path and os.path.exists(gfs_path):
os.remove(gfs_path)

0 comments on commit 755d449

Please sign in to comment.