visidata icon indicating copy to clipboard operation
visidata copied to clipboard

[save-] handle empty delimiter when safety_first

Open midichef opened this issue 3 weeks ago • 0 comments

With --safety-first, saving a sheet fails when using '\x00' as a delimiter.

echo "col\none\0two" |vd --safety-first --delimiter= -f tsv - then execute save-sheet:

File "/home/midichef/.local/lib/python3.10/site-packages/visidata/save.py", line 18, in safe_trdict
    ord(delim): vs.options.tsv_safe_tab, # \t
TypeError: ord() expected a character, but string of length 0 found

This PR changes the behavior to fail, with an explanatory message, when the delimiter is '\x00', '\r', or '\n'.

midichef avatar Jun 10 '24 01:06 midichef