~charles/charles-util

896fed8e89cfa64c58009ab920445703d0fc555b — Charles Daniels 4 years ago ec2d114 dev
fix crash on empty element text
1 files changed, 3 insertions(+), 2 deletions(-)

M bin/query-webpage
M bin/query-webpage => bin/query-webpage +3 -2
@@ 71,8 71,9 @@ def process_element(elem, extractmode, outputsep, extractarg=""):
            # we can't really do much of anything.
            show_warning("Ignored element '{}' because it had empty .text."
                         .format(elem))
        sys.stdout.write(elem.text)
        sys.stdout.write(outputsep)
        else:
            sys.stdout.write(elem.text)
            sys.stdout.write(outputsep)

    elif extractmode == "extract_attribute":
        for item in (i for i in elem.items() if i[0] == extractarg.replace('@', '')):