João Moço
João Moço

Reputation: 109

Getting ValueError: too many values to unpack for a GitHub package

I'm using a package from GitHub called plot-trec_eval to make a pdf with the precision-recall curve in it. I'm using a Google Colab notebook and, so far, I got this:

! python /content/plot-trec_eval/plot_pr_curve.py -f prc_23.pdf /content/drive/MyDrive/data/classes/23/23_N.txt /content/drive/MyDrive/data/classes/23/r23_N.txt

And I get this:

Traceback (most recent call last):
  File "/content/plot-trec_eval/plot_pr_curve.py", line 47, in <module>
    process(args.files, args.output)
  File "/content/plot-trec_eval/plot_pr_curve.py", line 11, in process
    result_list = [EvaluationResult(f) for f in files]
  File "/content/plot-trec_eval/plot_pr_curve.py", line 11, in <listcomp>
    result_list = [EvaluationResult(f) for f in files]
  File "/content/plot-trec_eval/eval_results.py", line 49, in __init__
    (field, query, value) = line.split()
ValueError: too many values to unpack (expected 3)

What seems to be the issue here? I'm not understanding. I've read the tracebacks and I still can't figure out the problem

Upvotes: 0

Views: 98

Answers (1)

Kolay.Ne
Kolay.Ne

Reputation: 1398

As you can see here in the source code, plot-trec_eval expects each of your files (processed by process) to be in a specific format: each line of them should consist of three "words" split by whitespaces (space / tab character / etc). The first of these words should represent something called "field" in the code, the second should describe a "query" and the last one should be a "value". You can find possible values for the "words" in the source too, but I guess you should know what you're doing when using the library.

Upvotes: 1

Related Questions