[meta-freescale] [Documentation][PATCH 3/3] scripts: output error messages to stderr

Lucas Dutra Nunes ldnunes at ossystems.com.br
Tue Mar 1 08:38:32 PST 2016


Signed-off-by: Lucas Dutra Nunes <ldnunes at ossystems.com.br>
---
 scripts/format_machine_list.py | 2 +-
 scripts/generate-bugs-table.py | 7 ++++---
 scripts/test-sheet-parser.py   | 4 ++--
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/scripts/format_machine_list.py b/scripts/format_machine_list.py
index 07f1437..778d4fc 100755
--- a/scripts/format_machine_list.py
+++ b/scripts/format_machine_list.py
@@ -14,7 +14,7 @@ def read_csv_file(csv_file):
             reader = csv.reader(csv_fd, delimiter=',')
             return list(reader)
     except IOError:
-        print('Could not read %s.  Aborting.') % csv_file
+        sys.stderr.write('Could not read %s.  Aborting.\n') % csv_file
         sys.exit(1)
 
 
diff --git a/scripts/generate-bugs-table.py b/scripts/generate-bugs-table.py
index 8f82bde..e9829bd 100755
--- a/scripts/generate-bugs-table.py
+++ b/scripts/generate-bugs-table.py
@@ -115,9 +115,10 @@ def process_arguments():
         try:
             time.strptime(start_date, "%Y-%m-%d")
         except ValueError:
-            print(os.path.basename(sys.argv[0]) +
-                  ": error: start_date must be in the following format: " +
-                  "YYYY-MM-DD")
+            msg = (os.path.basename(sys.argv[0]) +
+                   ": error: start_date must be in the following format: " +
+                   "YYYY-MM-DD")
+            sys.stderr.write(msg)
             exit(1)
 
     print(start_processing_message)
diff --git a/scripts/test-sheet-parser.py b/scripts/test-sheet-parser.py
index 17dded3..bb6f5da 100755
--- a/scripts/test-sheet-parser.py
+++ b/scripts/test-sheet-parser.py
@@ -49,7 +49,7 @@ def read_test_sheet(csv_file):
             reader = csv.reader(csv_fd, delimiter=',')
             return list(reader)
     except IOError:
-        print('Could not read %s.  Aborting.') % csv_file
+        sys.stderr.write('Could not read %s.  Aborting.\n') % csv_file
         sys.exit(1)
 
 def parse_board_file(board_file):
@@ -65,7 +65,7 @@ def parse_board_file(board_file):
                     board_spec['soc'] = get_descr(line)
             return board_spec
     except IOError:
-        print('Could not read %s.') % board_file
+        sys.stderr.write('Could not read %s.\n') % board_file
 
 
 def get_supported_boards(repos_dir):
-- 
2.1.4



More information about the meta-freescale mailing list