Add Logging Statements and Avoid Crash
The first commit adds a pair of logging statements to format_alignment. I thought it was worth alerting the user if an invalid column type was passed in.
The second commit avoids a crash if the script is passed an empty file (or if skip is large enough to skip all of the rows in a file). Compare the output of
touch empty.csv
python3 tably.py empty.csv
before and after the commit. One possible solution (the route I took) is to initialize num_columns to zero and then modify format_alignment to avoid an empty return value (which would cause a TeX error) when length is zero. If you'd like to handle it in another way you can skip this commit.
Thank you for your contribution!
I've started by looking at your second commit. You are right saying that currently the script has an ugly crash when there is an empty table (either empty file or too large skip).
Thanks for bringing my attention to this!
If you'd like to handle it in another way you can skip this commit.
I think I found another, simpler, way. I'm gonna push it soon, take a look when it is here.
The first commit adds a pair of logging statements to format_alignment. I thought it was worth alerting the user if an invalid column type was passed in.
Logging idea seems interesting, I'll think about it. See if you would maybe like to add logging also in places where there is currently printing to console (and maybe in other places too), and make another pull request.