Commit Graph

6 Commits

Author SHA1 Message Date
Julian Oes 9a96ca14be Tools: make Python import error more readable
The problem with printing the exception was that starting with
Python 3.6 the ImportError is yet another (sub) exception called
ModuleNotFoundError which can't be printed as a string and then triggers
another exception:

```
Traceback (most recent call last):
  File "/home/julianoes/src/Firmware/Tools/serial/generate_config.py", line 11, in <module>
    import jinja2
ModuleNotFoundError: No module named 'jinja2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/julianoes/src/Firmware/Tools/serial/generate_config.py", line 13, in <module>
    print("Failed to import jinja2: " + e)
TypeError: must be str, not ModuleNotFoundError
```

As per @bkueng's suggestion the easiest is to cast the exception to str
and that way prevent the second exception.
2020-02-14 11:40:05 +01:00
Julian Oes b04f68553e Tools: use Python 3, improve import checks
In more detail:
- Change shebang to Python 3.
- Suggest installation using pip3 as user.
2020-01-16 16:25:26 +01:00
Julian Oes 8897c69c8f Tools: use Python 3 in validate_yaml.py 2020-01-13 21:48:35 +00:00
Beat Küng c869cb0ea5 validate_yaml.py: fix for python3
RuntimeError: dictionary changed size during iteration
2019-07-25 10:38:57 -04:00
Alexis Paques 453ecfeb55 YAML: use Loaders and safe_load (#11910) 2019-07-10 15:15:29 +02:00
Beat Küng 52967bd654 Tools/validate_yaml: add schema validation for module yaml config files 2018-09-25 07:53:29 +02:00