cessen / kobo_jp_dict

A Japanese-English dictionary builder for Kobo e-readers.
Apache License 2.0
31 stars 2 forks source link

Thread 'main' panicked #6

Closed t3nma closed 1 year ago

t3nma commented 2 years ago

Hello, I was trying to use the tool to generate my own kobo dictionary but I'm running into the following error:

$ kobo_jp_dict -y jmdict_english.zip test.zip
Extracting bundled data...
    Metadata entries: 191598
    Pitch Accent entries: 124135
Loading dictionaries...
    jmdict_english.zip entries: 267130
Writing dictionary to disk...
thread 'main' panicked at 'assertion failed: process_output.status.success()', src/kobo.rs:75:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I'm running the program on Ubuntu 22.04 with kobo_jp_dict version 0.1.0 and MARISA 0.2.6.

cessen commented 2 years ago

Thank you for the bug report!

It appears that the marisa-build executable is either failing to run or failing to complete its work successfully.

Are you sure the marisa-build executable is in your path? What happens if you just run marisa-build from the command line in the same directory as you're trying to run kobo_jp_dict?

Regardless, the error message that kobo_jp_dict is giving is terrible and confusing, so I want to fix that once we figure out what's going on.

t3nma commented 2 years ago

Yes, it is in my path:

$ marisa-build -h
Usage: marisa-build [OPTION]... [FILE]...

Options:
  -n, --num-tries=[N]  limit the number of tries [1, 127] (default: 3)
  -t, --text-tail      build a dictionary with text TAIL (default)
  -b, --binary-tail    build a dictionary with binary TAIL
  -w, --weight-order   arrange siblings in weight order (default)
  -l, --label-order    arrange siblings in label order
  -c, --cache-level=[N]    specify the cache size [1, 5] (default: 3)
  -o, --output=[FILE]  write tries to FILE (default: stdout)
  -h, --help           print this help

Indeed, the error message is not very helpful. I even recompiled your program with RUST_BACKTRACE=1 set in main.rs but that too wasn't very helpful.. Could the problem be, perhaps, the MARISA version I'm using? What version are you using?

cessen commented 2 years ago

Could the problem be, perhaps, the MARISA version I'm using?

I'm also using 0.2.6, so I don't think that's the issue (just tested with kobo_jp_dict -y jmdict_english.zip test.zip, and it succeeds without error on my system). I'm running NixOS, so it's possible there's a difference there, although I'm skeptical.

I suspect at this point that to track down the issue I'll need to improve the error message first to be more informative, and then you can test with that. I'm a little short on time right now, but I'll try to get to that within the week.

Thank you again for the report and for your help with this!

t3nma commented 1 year ago

Hello again! Just came here to tell you that all seems to be working just fine now :man_shrugging:

I'll close the discussions since the problem was clearly in my system and it was probably fixed by some update in the meanwhile. Thanks!

cessen commented 1 year ago

Ah! Sorry it took me so long to get to this. A bunch of other stuff came up.

I'm actually going to reopen this, because I still think the error messages around this can be better, to help users get things set up correctly.

cessen commented 1 year ago

Fixed in c8ce82633da63d37d6a3dc688ac395c2a4e1358b

When marisa-build can't be found, a proper message is printed. Similarly, when marisa-build itself exits with an error, an error message is printed as well as marisa-build's stderr output, to help track down the issue.