[lxml-dev] Patch for xpathgrep.py

Thomas Schraitle tom_schr at web.de
Mon Jun 9 21:48:08 CEST 2008


Hi,

On Montag, 9. Juni 2008, Stefan Behnel wrote:
>
> Thomas Schraitle wrote:
> > I forgot about the Clark notation.
>
> Actually, I found that it's easier to stay with your simple option. If
> you work on the command line, the Clark notation just gets in the way.

Yes, the command line gets a bit long in this case. :)


> > [...]
>
> I updated the script a little. It now supports all methods of
> the unicode type as XPath functions, and some other goodies. Hope you
> like it.

Very good!

Ahh, by the way: I think, I discovered a strange behaviour that should be 
fixed too. Try to run it like this:

 # Without(!) any filename:
 $ xpathgrep.py /foo

I get this:

Traceback (most recent call last):
  File "tools/xpathgrep.py", line 256, in <module>
    found = main(options, args)
  File "tools/xpathgrep.py", line 242, in main
    sys.stdin, xpath, print_name, options.xinclude,
UnboundLocalError: local variable 'print_name' referenced before 
assignment

I think that is not the intended behavior, isn't it? :) Maybe the script 
should check, if the there are at least 3 arguments?


Thanks,
Tom

-- 
Thomas Schraitle


More information about the lxml-dev mailing list