I installiert jsonpath-RW 1.4.0 mitPython JSONPath Filterausdrücke Fehler, Unexpected Charakter für jsonpath-RW 1.4.0
sudo apt-get install python-jsonpath-rw
, die mit einem /usr/bin/jsonpath
kommt. Aber das gibt mir Fehler bei der Verwendung von Filterausdrücken:
$ jsonpath '$..book[?(@.price < 10)]' book.json
Traceback (most recent call last):
File "/usr/bin/jsonpath", line 11, in <module>
load_entry_point('jsonpath-rw==1.4.0', 'console_scripts', 'jsonpath.py')()
File "/usr/lib/python2.7/dist-packages/jsonpath_rw/bin/jsonpath.py", line 71, in entry_point
main(*sys.argv)
File "/usr/lib/python2.7/dist-packages/jsonpath_rw/bin/jsonpath.py", line 57, in main
expr = parse(args.expression)
File "/usr/lib/python2.7/dist-packages/jsonpath_rw/parser.py", line 14, in parse
return JsonPathParser().parse(string)
File "/usr/lib/python2.7/dist-packages/jsonpath_rw/parser.py", line 32, in parse
return self.parse_token_stream(lexer.tokenize(string))
File "/usr/lib/python2.7/dist-packages/jsonpath_rw/parser.py", line 55, in parse_token_stream
return new_parser.parse(lexer = IteratorToTokenStream(token_iterator))
File "/usr/lib/python2.7/dist-packages/ply/yacc.py", line 331, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "/usr/lib/python2.7/dist-packages/ply/yacc.py", line 1061, in parseopt_notrack
lookahead = get_token() # Get the next token
File "/usr/lib/python2.7/dist-packages/jsonpath_rw/parser.py", line 179, in token
return next(self.iterator)
File "/usr/lib/python2.7/dist-packages/jsonpath_rw/lexer.py", line 33, in tokenize
t = new_lexer.token()
File "/usr/lib/python2.7/dist-packages/ply/lex.py", line 393, in token
newtok = self.lexerrorf(tok)
File "/usr/lib/python2.7/dist-packages/jsonpath_rw/lexer.py", line 165, in t_error
raise JsonPathLexerError('Error on line %s, col %s: Unexpected character: %s ' % (t.lexer.lineno, t.lexpos - t.lexer.latest_newline, t.value[0]))
jsonpath_rw.lexer.JsonPathLexerError: Error on line 1, col 8: Unexpected character: ?
Also unterstützt jsonpath-rw 1.4.0 Filterausdrücke nicht?
Es scheint im Jahr 2015
Haben die Dinge geändert seitdem working fine according to this blog post, aber das ist zu sein?
Haben Sie das herausgefunden? Ich treffe das gleiche Problem. – Mike
Danke für die Bestätigung @Mike. Ich bin froh, dass es nicht nur ich ist. Ich komme noch nicht dazu, es zu untersuchen, und höchstwahrscheinlich wird es nie passieren. Könnten Sie dort einen Fehler protokollieren? – xpt