Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[save-] handle empty delimiter when safety_first #2421

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

midichef
Copy link
Contributor

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'.

Copy link
Owner

@saulpw saulpw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point I'd like to rework safety_first, since it's used in only a few places. But this is fine for what it is now.

@anjakefala anjakefala merged commit 2549f14 into saulpw:develop Jul 2, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants