[tor-commits] [onionperf/master] Warns instead of fails if supplied labels are paths

karsten at torproject.org karsten at torproject.org
Wed Jun 3 13:39:29 UTC 2020


commit 225199fa015a8b42fde91cba3488138688b35433
Author: Ana Custura <ana at netstat.org.uk>
Date:   Wed Jun 3 11:07:47 2020 +0100

    Warns instead of fails if supplied labels are paths
---
 onionperf/onionperf | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/onionperf/onionperf b/onionperf/onionperf
index 14a6661..f430c3f 100755
--- a/onionperf/onionperf
+++ b/onionperf/onionperf
@@ -467,12 +467,12 @@ class PathStringArgsAction(argparse.Action):
 
         # extract the paths to our data, and the label for the legend
         label = values[-1]
+        paths = values[:-1]
         # fail if the label is a path
         check_label = os.path.abspath(os.path.expanduser(label))
-        if os.path.exists(check_label):
-            raise argparse.ArgumentError(self, "The supplied label cannot be a path")
+        if os.path.exists(check_label) and label not in paths:
+            logging.warning("The label supplied looks like a path: {}".format(label))
 
-        paths = values[:-1]
         dir_paths = []
         for item in paths:
             p = os.path.abspath(os.path.expanduser(item))



More information about the tor-commits mailing list