Active-passive-to-ambig.py has "ValueError: need more than 1 value to unpack"

Based on bonvinlab.org/education/HADDOCK24/HADDOCK24-local-tutorial/#defining-restraints-for-docking, I try to run

active-passive-to-ambig.py 4G6K-active.list 4I1B-passive.list | sed s/segid/name\ CA\ and\ segid/g | sed s/2.0/3.0/g >antibody-antigen-ambig.tbl

But I got error messages:

Traceback (most recent call last):
  File "/home/lanselibai/software/haddock-tools/active-passive-to-ambig.py", line 79, in <module>
    main()
  File "/home/lanselibai/software/haddock-tools/active-passive-to-ambig.py", line 73, in main
    active1, passive1 = [[int(x) for x in line.split()] for line in open(sys.argv[1])]
ValueError: need more than 1 value to unpack

Both 4G6K-active.list and 4I1B-passive.list contain only two lines, each line is either empty or numbers separated by space, representing residue numbers.

By the way, could there be a “haddock tool web portal”? Thanks!

Which python version are you using?

I have both python 2 and 3 installed:

python -V
Python 2.7.17

python3 -V
Python 3.6.9

which version the active-passive-to-ambig.py uses?

This command also comes from the haddock-tools, and I have no problem running it
restrain_bodies.py 4G6K-clean.pdb >antibody-unambig.tbl

$ python -V
Python 2.7.17

$ python3 -V
Python 3.6.9

$ python3 ~/software/haddock-tools/active-passive-to-ambi
g.py 4G6K-active.list 4I1B-passive.list >antibody-antigen-ambig.tbl
Traceback (most recent call last):
  File "/home/lanselibai/software/haddock-tools/active-passive-to-ambig.py", line 79, in <module>
    main()
  File "/home/lanselibai/software/haddock-tools/active-passive-to-ambig.py", line 73, in main
    active1, passive1 = [[int(x) for x in line.split()] for line in open(sys.argv[1])]
ValueError: not enough values to unpack (expected 2, got 1)

$ python ~/software/haddock-tools/active-passive-to-ambig
.py 4G6K-active.list 4I1B-passive.list >antibody-antigen-ambig.tbl
Traceback (most recent call last):
  File "/home/lanselibai/software/haddock-tools/active-passive-to-ambig.py", line 79, in <module>
    main()
  File "/home/lanselibai/software/haddock-tools/active-passive-to-ambig.py", line 73, in main
    active1, passive1 = [[int(x) for x in line.split()] for line in open(sys.argv[1])]
ValueError: need more than 1 value to unpack

$ ~/software/haddock-tools/active-passive-to-ambig.py 4G6
K-active.list 4I1B-passive.list >antibody-antigen-ambig.tbl
Traceback (most recent call last):
  File "/home/lanselibai/software/haddock-tools/active-passive-to-ambig.py", line 79, in <module>
    main()
  File "/home/lanselibai/software/haddock-tools/active-passive-to-ambig.py", line 73, in main
    active1, passive1 = [[int(x) for x in line.split()] for line in open(sys.argv[1])]
ValueError: need more than 1 value to unpack

Just tested on my max using the e2a and hpr list files from the tutorial:

~/haddock_git/haddock-tools/active-passive-to-ambig.py e2a-act-pass.list.txt hpr-act-pass.list.txt

Works perfectly both with python2.7 and python3.

How did you create your 4G6K-active.list 4I1B-passive.list files?

Do they really have both two lines (even if an empty one)?

It could also be a Windows issue in case you are working under Windows… line ending format…

Thank you for testing it. I follow the tutorial exactly. Yes, they both have only two lines.

I wish I can upload files or pictures. Can you give me the permission?

I got it!

In the 4G6K-active.list, the second line is empty, so maybe the software assumes the second line does not exist. So I added a third line, which is also empty. Then it works!