From 585d3f6986aceef04931a273d463c8e843d5c7f1 Mon Sep 17 00:00:00 2001 From: Tommy Olofsson <tommy.olofsson.90@gmail.com> Date: Mon, 2 Feb 2015 16:41:52 +0100 Subject: [PATCH] Do not assume system arguments. --- tools/lc2csv.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/lc2csv.py b/tools/lc2csv.py index f38d147..b5fc3e0 100755 --- a/tools/lc2csv.py +++ b/tools/lc2csv.py @@ -1,8 +1,9 @@ #!/usr/bin/env python -import time import argparse import labcomm +import sys +import time class Reader(object): @@ -90,7 +91,7 @@ def dump_labels(current, _type): print -def main(): +def main(main_args): parser = argparse.ArgumentParser() parser.add_argument('elc', type=str, help="The log file.") parser.add_argument('-f', '--follow', action='store_true', @@ -105,7 +106,7 @@ def main(): help="timeout to terminate when no changes are detected. " "Requires -f.") - args = parser.parse_args() + args = parser.parse_args(main_args) seen = {} current = {} _type = {} @@ -147,4 +148,4 @@ def main(): if __name__ == "__main__": - main() + main(sys.argv[1:]) -- GitLab