Skip to content

Commit

Permalink
[svn r4005] r4861@delle: sbehnel | 2008-11-14 10:52:38 +0100
Browse files Browse the repository at this point in the history
 fixed missing imports and name errors

--HG--
branch : trunk
  • Loading branch information
scoder committed Nov 16, 2008
1 parent 8cf02e4 commit aecd2fb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/lxml/cssselect.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ def parse(string):
try:
return parse_selector_group(stream)
except SelectorSyntaxError:
import sys
e = sys.exc_info()[1]
e.args = tuple(["%s at %s -> %s" % (
e, stream.used, list(stream))])
Expand Down Expand Up @@ -900,6 +901,7 @@ def tokenize_symbol(s, pos):
try:
result = result.encode('ASCII', 'backslashreplace').decode('unicode_escape')
except UnicodeDecodeError:
import sys
e = sys.exc_info()[1]
raise SelectorSyntaxError(
"Bad symbol %r: %s" % (result, e))
Expand Down
1 change: 1 addition & 0 deletions src/lxml/html/formfill.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from lxml.html import fromstring, tostring, XHTML_NAMESPACE
from lxml.html import _forms_xpath, _options_xpath, _nons, _transform_result
from lxml.html import defs
import copy
try:
basestring = __builtins__["basestring"]
except (KeyError, NameError):
Expand Down
4 changes: 2 additions & 2 deletions src/lxml/html/html5parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def fragment_fromstring(html, create_parent=False,

result = children[0]
if result.tail and result.tail.strip():
raise etree.ParserError('Element followed by text: %r' % el.tail)
raise etree.ParserError('Element followed by text: %r' % result.tail)
result.tail = None
return result

Expand Down Expand Up @@ -157,7 +157,7 @@ def parse(filename_url_or_file, guess_charset=True, parser=None):
fp = urllib.urlopen(filename_url_or_file)
else:
fp = filename_url_or_file
return parser.parse(html, useChardet=guess_charset)
return parser.parse(fp, useChardet=guess_charset)


html_parser = HTMLParser()
Expand Down
1 change: 1 addition & 0 deletions tools/xpathgrep.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
try:
import lxml.etree as et
except ImportError, e:
import sys
print >> sys.stderr, "ERR: %s." % e
sys.exit(5)

Expand Down

0 comments on commit aecd2fb

Please sign in to comment.