ufal / neuralmonkey

An open-source tool for sequence learning in NLP built on TensorFlow.
BSD 3-Clause "New" or "Revised" License
410 stars 104 forks source link

Fix syntax error logging in configuration #753

Open jindrahelcl opened 6 years ago

jindrahelcl commented 6 years ago

When there is a typo in the config, e.g.:

[val_data]
o

then the error message looks like this:

Traceback (most recent call last):
  File "/lnet/troja/projects/mtm18-unsupervised/neuralmonkey/bin/neuralmonkey/config/configuration.py", line 73, in load_file
    raw_config, config_dict = parse_file(file, changes)
  File "/lnet/troja/projects/mtm18-unsupervised/neuralmonkey/bin/neuralmonkey/config/parsing.py", line 223, in parse_file
    config = _parse_ini(config_file)
  File "/lnet/troja/projects/mtm18-unsupervised/neuralmonkey/bin/neuralmonkey/config/parsing.py", line 183, in _parse_ini
    config.read_file(line_numbers, source=filename)
  File "/home/helcl/lib/python3.5/configparser.py", line 715, in read_file
    self._read(f, source)
  File "/home/helcl/lib/python3.5/configparser.py", line 1104, in _read
    e = self._handle_error(e, fpname, lineno, line)
  File "/home/helcl/lib/python3.5/configparser.py", line 1124, in _handle_error
    exc = ParsingError(fpname)
  File "/home/helcl/lib/python3.5/configparser.py", line 305, in __init__
    raise ValueError("Required argument `source' not given.")
ValueError: Required argument `source' not given.

fix this.