Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Throw readable error when colors used instead of color_code #265

Open
scandey opened this issue Jan 10, 2022 · 2 comments
Open

Comments

@scandey
Copy link

scandey commented Jan 10, 2022

Hello! I discovered WireViz today while looking for options to improve on my current harnessing system of Excel spreadsheets.
I've been attempting to use it, but I keep coming across exceptions without any clear way to debug them.

The issue I keep hitting my head against at the moment is a TypeError:

Traceback (most recent call last):
  File "/usr/local/bin/wireviz", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/wireviz/wireviz.py", line 266, in main
    parse(yaml_input, file_out=file_out)
  File "/usr/local/lib/python3.9/site-packages/wireviz/wireviz.py", line 188, in parse
    harness.connect(from_name, from_pin, via_name, via_pin, to_name, to_pin)
  File "/usr/local/lib/python3.9/site-packages/wireviz/Harness.py", line 72, in connect
    if via_wire in cable.colors and via_wire in cable.wirelabels:
TypeError: 'in <string>' requires string as left operand, not int

dsub-airborn.txt

I've included my .yml file as a .txt so that Github would let me upload it. I'm sure I'm doing something silly, but for the life of me I can't figure it out. (Edited to replace file)

Versions:
wireviz 0.3.2
dot - graphviz version 2.50.0 (20211204.2007)
Python 3.9.9
Mac OS 12.1

@scandey
Copy link
Author

scandey commented Jan 10, 2022

Ah! I just figured it out: I used colors instead of color_code for a cable instance.

I've edited the title to change from bug report to feature request: this seems like the kind of syntax mistake that should throw an error with line number in the YML source, rather than falling through to a TypeError.

@scandey scandey changed the title [bug] TypeError: 'in <string>' requires string as left operand, not int (connect in Harness.py) [feature] Throw readable error when colors used instead of color_code Jan 10, 2022
@kvid
Copy link
Collaborator

kvid commented Feb 12, 2022

This is related to the general error message improvements discussed in #207.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants