Example #1
0
                print("--------------------")
                print("METAR code: %s" % line)
                print(string.join(err.args,", "))

def process_files(files):
    """Decode METAR lines from the given files."""
    for file in files:
        fh = open(file,"r")
        for line in fh.readlines():
            process_line(line)

if files:
    if prof:
        profile.run('process_files(files)')
    else:
        process_files(files)
else:
    # read lines from stdin 
    while True:
      try:
          line = sys.stdin.readline()
          if line == "":
             break
          process_line(line)
      except KeyboardInterrupt:
          break

if prof:
    ps = pstats.load('metar.prof')
    print(ps.strip_dirs().sort_stats('time').print_stats())
Example #2
0
                print(", ".join(exc.args))


def process_files(files):
    """Decode METAR lines from the given files."""
    for file in files:
        fh = open(file, "r")
        for line in fh.readlines():
            process_line(line)


if files:
    if prof:
        profile.run("process_files(files)")
    else:
        process_files(files)
else:
    # read lines from stdin
    while True:
        try:
            line = sys.stdin.readline()
            if line == "":
                break
            process_line(line)
        except KeyboardInterrupt:
            break

if prof:
    ps = pstats.load("metar.prof")
    print(ps.strip_dirs().sort_stats("time").print_stats())