jmespath/jmespath.terminal

Exception on invalid input

Opened this issue · 0 comments

To reproduce:

  • start jpterm
  • type &f
  • watch the program abort
Traceback (most recent call last):
  File "/usr/bin/jpterm", line 6, in <module>
    jpterm.main()
  File "/usr/lib/python3.8/site-packages/jpterm.py", line 229, in main
    display.main(screen=screen)
  File "/usr/lib/python3.8/site-packages/jpterm.py", line 146, in main
    self.loop.run()
  File "/usr/lib/python3.8/site-packages/urwid/main_loop.py", line 287, in run
    self._run()
  File "/usr/lib/python3.8/site-packages/urwid/main_loop.py", line 385, in _run
    self.event_loop.run()
  File "/usr/lib/python3.8/site-packages/urwid/main_loop.py", line 790, in run
    self._loop()
  File "/usr/lib/python3.8/site-packages/urwid/main_loop.py", line 827, in _loop
    self._watch_files[fd]()
  File "/usr/lib/python3.8/site-packages/urwid/raw_display.py", line 416, in <lambda>
    wrapper = lambda: self.parse_input(
  File "/usr/lib/python3.8/site-packages/urwid/raw_display.py", line 515, in parse_input
    callback(processed, processed_codes)
  File "/usr/lib/python3.8/site-packages/urwid/main_loop.py", line 412, in _update
    self.process_input(keys)
  File "/usr/lib/python3.8/site-packages/urwid/main_loop.py", line 513, in process_input
    k = self._topmost_widget.keypress(self.screen_size, k)
  File "/usr/lib/python3.8/site-packages/urwid/container.py", line 1115, in keypress
    return self.header.keypress((maxcol,),key)
  File "/usr/lib/python3.8/site-packages/urwid/container.py", line 1621, in keypress
    key = self.focus.keypress(tsize, key)
  File "/usr/lib/python3.8/site-packages/urwid/widget.py", line 1484, in keypress
    self.insert_text(key)
  File "/usr/lib/python3.8/site-packages/urwid/widget.py", line 1410, in insert_text
    self.set_edit_text(result_text)
  File "/usr/lib/python3.8/site-packages/urwid/widget.py", line 1365, in set_edit_text
    self._emit("change", text)
  File "/usr/lib/python3.8/site-packages/urwid/widget.py", line 461, in _emit
    signals.emit_signal(self, name, self, *args)
  File "/usr/lib/python3.8/site-packages/urwid/signals.py", line 265, in emit
    result |= self._call_callback(callback, user_arg, user_args, args)
  File "/usr/lib/python3.8/site-packages/urwid/signals.py", line 295, in _call_callback
    return bool(callback(*args_to_pass))
  File "/usr/lib/python3.8/site-packages/jpterm.py", line 137, in _on_edit
    json.dumps(result, indent=2))
  File "/usr/lib/python3.8/json/__init__.py", line 234, in dumps
    return cls(
  File "/usr/lib/python3.8/json/encoder.py", line 201, in encode
    chunks = list(chunks)
  File "/usr/lib/python3.8/json/encoder.py", line 438, in _iterencode
    o = _default(o)
  File "/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type _Expression is not JSON serializable