hgbook
changeset 893:40e41b3eeaf6
Add sysargs checker.
author | dukebody <dukebody@gmail.com> |
---|---|
date | Tue Oct 20 00:58:33 2009 +0200 (2009-10-20) |
parents | 86073756fe77 |
children | bc64bbc47c86 |
files | web/hgbook/converter.py |
line diff
1.1 --- a/web/hgbook/converter.py Mon Oct 19 20:01:15 2009 +0200 1.2 +++ b/web/hgbook/converter.py Tue Oct 20 00:58:33 2009 +0200 1.3 @@ -17,11 +17,14 @@ 1.4 sel = CSSSelector('p, pre, h1, table.equation') 1.5 body = CSSSelector('body') 1.6 1.7 -filename = args[0] 1.8 +try: 1.9 + filename = args[0] 1.10 +except IndexError: 1.11 + raise IndexError("Usage: %s <path-to-html-file>" % __file__) 1.12 + 1.13 tree = etree.parse(filename, html.HTMLParser()) 1.14 root = tree.getroot() 1.15 1.16 - 1.17 body(root)[0].set('id', doc_id) 1.18 1.19 for element in sel(root):