139 parser = Parser()
140
141
142 for src in FLAGS.sources:
143 if src == '-':
144 parser.parse_file(sys.stdin)
145 else:
146 with open(src, mode='r') as infile:
147 parser.parse_file(infile)
148
149
150 if not FLAGS.open:
151 parser.print_csv()
152 else:
153 dirname = tempfile.mkdtemp()
154 basename = FLAGS.name
155 if os.path.splitext(basename)[1] != '.csv':
156 basename += '.csv';
157 pathname = os.path.join(dirname, basename)
158 with open(pathname, mode='w') as tmpfile:
159 parser.print_csv(outfile=tmpfile)
160 fileuri = urlparse.urljoin('file:', urllib.pathname2url(pathname))
161 print(
'opening %s' % fileuri)
162 webbrowser.open(fileuri)
163
164
def print(*args, **kwargs)