nengo/nengo-fpga

Give better error when fpga not found in `fpga_config`

xchoo opened this issue · 1 comments

xchoo commented

When you use an FPGA name string not found in fpga_config, the current error message is something like:

Traceback (most recent call last):
  File "/home/xchoo/.conda/envs/nengo-fpga/lib/python3.6/configparser.py", line 1138, in _unify_values
    sectiondict = self._sections[section]
KeyError: 'de112'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "nengo_fpga/dna_extractor.py", line 246, in <module>
    fpga.connect()
  File "nengo_fpga/dna_extractor.py", line 164, in connect
    fpga_config.get(self.fpga_name, 'ip'), flush=True)
  File "/home/xchoo/.conda/envs/nengo-fpga/lib/python3.6/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/home/xchoo/.conda/envs/nengo-fpga/lib/python3.6/configparser.py", line 1141, in _unify_values
    raise NoSectionError(section)
configparser.NoSectionError: No section: 'de112'

This can be better handled with better error messaging.

We decided not to throw an error, but instead throw a warning and run without the FPGA.