From 74e4c12a07115669b409037ef0927f988916b709 Mon Sep 17 00:00:00 2001 From: Boud Roukema Date: Thu, 8 Aug 2019 21:15:43 +0200 Subject: [PATCH] zobov.py - fix bug that moves all files if handle is empty An empty value of `handle` in `parameters/params.py` can cause zobov to shift all files from the Revolver/ main directory into a subsubdirectory and then crash due to recursiveness. This commit fixes the bug by setting a default handle "myhandle" if handle is an empty string. Side effect: this commit also solves a bug that I haven't posted: if `output_folder` does not have a trailing slash, then the zobov directory handling strategies are again unlikely to do what is expected by the user. It's easy to use a python library function to add a trailing slash in an OS-independent way, so that is done in this commit too. --- python_tools/zobov.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/python_tools/zobov.py b/python_tools/zobov.py index c98a0ae..2a8a7f3 100755 --- a/python_tools/zobov.py +++ b/python_tools/zobov.py @@ -29,10 +29,13 @@ def __init__(self, do_tessellation=True, tracer_file="", handle="", output_folde self.verbose=verbose # the prefix/handle used for all output file names - self.handle = handle + if handle in (None,'') or not myString.strip(): + self.handle = "myhandle" # default handle if empty + else: + self.handle = handle # output folder - self.output_folder = output_folder + self.output_folder = os.path.join(output_folder,'') # add a trailing slash if needed if not os.access(self.output_folder, os.F_OK): os.makedirs(self.output_folder)