From f071e308b095e9ba78346b8f5c9ac8a071f6a5b6 Mon Sep 17 00:00:00 2001 From: Mitch Watrous Date: Thu, 26 Apr 2012 10:19:11 -0700 Subject: [PATCH] Bug 1391 - .ns3rc does not allow comments as expected --- utils.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/utils.py b/utils.py index 9db09dc5d..5c79d28eb 100644 --- a/utils.py +++ b/utils.py @@ -26,6 +26,12 @@ def get_list_from_file(file_path, list_name): list_string = "" parsing_multiline_list = False for line in file_in: + + # Remove any comments. + if '#' in line: + (line, comment) = line.split('#', 1) + + # Parse the line. if list_name in line or parsing_multiline_list: list_string += line @@ -60,6 +66,12 @@ def get_bool_from_file(file_path, bool_name, value_if_missing): # Look for the boolean variable. bool_found = False for line in file_in: + + # Remove any comments. + if '#' in line: + (line, comment) = line.split('#', 1) + + # Parse the line. if bool_name in line: # Evaluate the variable's line once it is found. Make # the split function only split it once.