customizations icon indicating copy to clipboard operation
customizations copied to clipboard

multi_connect.py ValueError

Open trondforgaard opened this issue 2 years ago • 3 comments

Throws this error when accessing the script.

<class 'ValueError'>

too many values to unpack (expected 2)

Python version: 3.8.10
NetBox version: 3.2.1

trondforgaard avatar May 13 '22 08:05 trondforgaard

The problem is that cable_status passes LinkStatusChoices.CHOICES as choices to the ChoiceVar contructor.

The VoiceVar constructor expects a list of two-tuples, while LinkStatusChoices.CHOICES is a three-tuple (The third item is the corresponding color).

I'm not sure if this should be fixed in

  • the extras.scripts module, by accepting three-tuples
  • the utilities.choices module, by providing a method or accessor that strips the 3rd element
  • the script itself, by stripping the third element itself ([(choice[0], choice[1]) for choice in choices])

yaiqsa avatar May 31 '22 09:05 yaiqsa

This is broken for me as well. Does not work on 3.2 or later. I would love it if someone knew how to fix it...

shatt79 avatar May 31 '22 19:05 shatt79

I ended up just commenting out the "cable_status = ChoiceVar..." line and the "status=data["cable_status"]" line

The cable status field isn't that important. If I'm connecting cables, its obvious that they are "Connected", so letting the system use the default value is fine.

shatt79 avatar Jun 08 '22 17:06 shatt79