Create missing folders if needed
Refs https://redmine.teklia.com/issues/7377
To avoid this error when the folder /home/training_data/ATR_page/Aurexus/aurexus_page_sem
doesn't exist
$ teklia-dan dataset entities \
/home/training_data/ATR_page/Aurexus/aurexus-dossiers-de-pensions-militaires-20240521-083117.sqlite \
--output-file /home/training_data/ATR_page/Aurexus/aurexus_page_sem/entities.yml
Traceback (most recent call last):
File "/home/users/mblanco/dev/dan/bin/teklia-dan", line 8, in <module>
sys.exit(main())
File "/home/users/mblanco/dev/dan/dan/cli.py", line 31, in main
status = args.pop("func")(**args)
File "/home/users/mblanco/dev/dan/dan/datasets/entities/extract.py", line 21, in run
output_file.write_text(
File "/usr/lib/python3.10/pathlib.py", line 1154, in write_text
with self.open(mode='w', encoding=encoding, errors=errors, newline=newline) as f:
File "/usr/lib/python3.10/pathlib.py", line 1119, in open
return self._accessor.open(self, mode, buffering, encoding, errors,
FileNotFoundError: [Errno 2] No such file or directory: '/home/training_data/ATR_page/Aurexus/aurexus_page_sem/entities.yml'