SEBA-421 Print error messages to stderr, not stdout;
Add Makefile
Change-Id: I7d4285a343d723ff3fc2aa2f7b1abfb806de8966
diff --git a/src/plyxproto/helpers.py b/src/plyxproto/helpers.py
index 15136f5..a38d716 100644
--- a/src/plyxproto/helpers.py
+++ b/src/plyxproto/helpers.py
@@ -14,6 +14,7 @@
from __future__ import print_function
from six.moves import range
+import sys
class LexHelper:
@@ -196,7 +197,7 @@
def f(element):
if self.verbose:
msg = 'unimplemented call to {}; ignoring ({})'
- print((msg.format(name, element)))
+ print((msg.format(name, element)), file=sys.stderr)
return True
return f
diff --git a/src/plyxproto/logicparser.py b/src/plyxproto/logicparser.py
index 1c4922b..b948d46 100644
--- a/src/plyxproto/logicparser.py
+++ b/src/plyxproto/logicparser.py
@@ -5,6 +5,7 @@
__copyright__ = "Copyright (C) 2017 Open Networking Lab"
__version__ = "1.0"
+import sys
from .helpers import LexHelper
@@ -78,7 +79,8 @@
def t_error(self, t):
print(("Illegal character '{}' ({}) in line {}".format(
- t.value[0], hex(ord(t.value[0])), t.lexer.lineno)))
+ t.value[0], hex(ord(t.value[0])), t.lexer.lineno)),
+ file=sys.stderr)
t.lexer.skip(1)
diff --git a/src/plyxproto/parser.py b/src/plyxproto/parser.py
index aabf2eb..f96125c 100755
--- a/src/plyxproto/parser.py
+++ b/src/plyxproto/parser.py
@@ -37,6 +37,7 @@
from .helpers import LexHelper, LU
from .logicparser import FOLParser, FOLLexer, FOLParsingError
import ast
+import sys
class PythonError(Exception):
@@ -155,7 +156,8 @@
def t_error(self, t):
print(("Illegal character '{}' ({}) in line {}".format(
- t.value[0], hex(ord(t.value[0])), t.lexer.lineno)))
+ t.value[0], hex(ord(t.value[0])), t.lexer.lineno)),
+ file=sys.stderr)
t.lexer.skip(1)