Skip to content

Commit

Permalink
renabled ParserErrors when an error file is not in use
Browse files Browse the repository at this point in the history
  • Loading branch information
phobson committed Oct 24, 2012
1 parent af5d266 commit 2d7d99e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions metar/Metar.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,8 @@ def __init__(self, metarcode, month=None, year=None,
errorfile.write(msg)
else:
print(msg)
#raise ParserError(handler.__name__+" failed while processing '"+code+"'\n"+string.join(err.args))
#raise err
raise ParserError(handler.__name__+" failed while processing '"+code+"'\n"+string.join(err.args))
raise err
if self._unparsed_groups:
code = ' '.join(self._unparsed_groups)
msg = "Unparsed groups: '%s' in '%s'\n" % (code, self.code)
Expand Down
24 changes: 12 additions & 12 deletions parse_metar.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ def usage():
program = os.path.basename(sys.argv[0])
print("Usage: %s [-s] [<file>]" % program)
options = """Options:
<file> ... a file containing METAR reports to parse
-q ....... run "quietly" - just report parsing error.
-s ....... run silently. (no output)
-p ....... run with profiling turned on.
This program reads lines containing coded METAR reports from a file
and prints human-reable reports. Lines are taken from stdin if no
file is given. For testing purposes, the script can run silently,
reporting only when a METAR report can't be fully parsed.
"""
<file> ... a file containing METAR reports to parse
-q ....... run "quietly" - just report parsing error.
-s ....... run silently. (no output)
-p ....... run with profiling turned on.
This program reads lines containing coded METAR reports from a file
and prints human-reable reports. Lines are taken from stdin if no
file is given. For testing purposes, the script can run silently,
reporting only when a METAR report can't be fully parsed.
"""
print(options)
sys.exit(1)

Expand All @@ -36,12 +36,12 @@ def usage():
if opt[0] == '-s':
silent = True
report = False
elif opt[0] == '-q':
elif opt[0] == '-q':
report = False
elif opt[0] == '-d':
elif opt[0] == '-d':
debug = True
Metar.debug = True
elif opt[0] == '-p':
elif opt[0] == '-p':
prof = True
except:
usage()
Expand Down

0 comments on commit 2d7d99e

Please sign in to comment.