Closed arademaker closed 1 year ago
note also that verbose level is not increasing.
For logging verbosity: the -v
option is shared by all commands, but for mkprof
there are no logging calls in the command code nor in the underlying delphin.tsdb
module, so the option doesn't do anything right now.
For the error you're seeing: I'm not able to reproduce it. Can you tell me what version you're running?
$ delphin mkprof -i all.txt --delimiter "@" --relations ~/grammars/erg-trunk/tsdb/skeletons/Relations --skeleton all
9746 bytes relations
1614 bytes item
$ delphin --version
delphin 1.5.1
I am running the last version. The problem is an empty i-input
, but maybe we can try to have a better error handling. If you guide me suggesting how to add the loginng and better try/catch in the profile creation, I can try to make a PR.
Ok thanks, I see the error when an i-input
field is empty.
If you guide me suggesting how to add the loginng and better try/catch in the profile creation, I can try to make a PR.
For logging, use the logger
object. Avoid logging inside tight loops, but if you must, use logging.isEnabledFor(level)
(see here and examples in code). I don't want to spam the logger, either, so only log things that aid in debugging.
For the error, rather than just try-excepting the offending line, I'd rather figure out why it's getting to that state and try to avoid that. Try-excepts tend to hide errors that I'd rather be aware of. In this case, when you use --delimiter="@"
, the splitter function (determined in _make_split()
in delphin/commands.py
) is tsdb.split(), which is defined to return None
for empty columns. Since this is an expected (but overlooked) column value, it's probably best to just detect this special case and set i-length
to 0.
I have released v1.6.0 already, so I've removed this issue from the milestone. I'm happy to put it in a 1.6.1 patch release.
As a hint, the problem is here:
Line 424 assumes that colmap['i-input']
will be a string, but it's None
when the column is empty, so this needs to be checked.
This is the file all.txt, I am trying to have the first column of the file mapped to the
i-origin
and the second column to thei-comment
: