nbedos / termtosvg

Record terminal sessions as SVG animations
https://nbedos.github.io/termtosvg/
BSD 3-Clause "New" or "Revised" License
9.71k stars 436 forks source link

Idle timeout expected as int, but is float #97

Closed agross closed 5 years ago

agross commented 5 years ago

Trying to render this cast file:

{"version": 2, "width": 138, "height": 44, "timestamp": 1560322449, "idle_time_limit": 1.0, "env": {"SHELL": "/usr/local/bin/zsh", "TERM": "xterm-256color"}}

raises this error:

Rendering started
Traceback (most recent call last):
  File "/usr/local/Cellar/termtosvg/0.8.0/libexec/lib/python3.7/site-packages/termtosvg/asciicast.py", line 89, in read_records
    yield AsciiCastV2Record.from_json_line(line)
  File "/usr/local/Cellar/termtosvg/0.8.0/libexec/lib/python3.7/site-packages/termtosvg/asciicast.py", line 34, in from_json_line
    return AsciiCastV2Header.from_json_line(line)
  File "/usr/local/Cellar/termtosvg/0.8.0/libexec/lib/python3.7/site-packages/termtosvg/asciicast.py", line 183, in from_json_line
    header = cls(**filtered_attributes)
  File "/usr/local/Cellar/termtosvg/0.8.0/libexec/lib/python3.7/site-packages/termtosvg/asciicast.py", line 159, in __new__
    .format(attr_name, type(attr), cls.types[attr_name]))
termtosvg.asciicast.AsciiCastError: Invalid type for attribute idle_time_limit: <class 'float'> (expected one of (<class 'NoneType'>, <class 'int'>))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/termtosvg/0.8.0/libexec/lib/python3.7/site-packages/termtosvg/asciicast.py", line 49, in _read_v1_records
    json_dict = json.loads(data)
  File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 158)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/termtosvg", line 6, in <module>
    termtosvg.main.main()
  File "/usr/local/Cellar/termtosvg/0.8.0/libexec/lib/python3.7/site-packages/termtosvg/main.py", line 286, in main
    args.min_frame_duration, args.max_frame_duration)
  File "/usr/local/Cellar/termtosvg/0.8.0/libexec/lib/python3.7/site-packages/termtosvg/main.py", line 207, in render_subcommand
    template=template)
  File "/usr/local/Cellar/termtosvg/0.8.0/libexec/lib/python3.7/site-packages/termtosvg/anim.py", line 145, in render_animation
    cell_height)
  File "/usr/local/Cellar/termtosvg/0.8.0/libexec/lib/python3.7/site-packages/termtosvg/anim.py", line 167, in _render_preparation
    header = next(records)
  File "/usr/local/Cellar/termtosvg/0.8.0/libexec/lib/python3.7/site-packages/termtosvg/term.py", line 296, in screen_events
    header = next(records)
  File "/usr/local/Cellar/termtosvg/0.8.0/libexec/lib/python3.7/site-packages/termtosvg/asciicast.py", line 92, in read_records
    yield from _read_v1_records(cast_file.read())
  File "/usr/local/Cellar/termtosvg/0.8.0/libexec/lib/python3.7/site-packages/termtosvg/asciicast.py", line 51, in _read_v1_records
    raise AsciiCastError from exc
termtosvg.asciicast.AsciiCastError
$ asciinema --version
asciinema 2.0.2

termtosvg from Homebrew

nbedos commented 5 years ago

Yep, my bad! It should be fixed by https://github.com/nbedos/termtosvg/commit/1980275fc3baeb411e3dfc80e31f9be08c3d6e1e.

agross commented 5 years ago

Thanks! 👍 Eagerly awaiting a Homebrew update ;-)

nbedos commented 5 years ago

Fixed in https://github.com/nbedos/termtosvg/releases/tag/0.9.0