verify.py --create-configuration-file crashes for local file
When running
verify.py --create-configuration-file config.py
this crashes with the error:
File "miniconda/envs/bob/bin/verify.py", line 11, in <module>
sys.exit(main())
File "miniconda/envs/bob/lib/python3.7/site-packages/bob/bio/base/script/verify.py", line 432, in main
args = parse_arguments(command_line_parameters)
File "miniconda/envs/bob/lib/python3.7/site-packages/bob/bio/base/script/verify.py", line 34, in parse_arguments
skips = ['preprocessing', 'extractor-training', 'extraction', 'projector-training', 'projection', 'enroller-training', 'enrollment', 'score-computation', 'concatenation', 'calibration'])
File "miniconda/envs/bob/lib/python3.7/site-packages/bob/bio/base/tools/command_line.py", line 425, in initialize
args = parse_config_file(parsers, args, args_dictionary, keywords, skips)
File "miniconda/envs/bob/lib/python3.7/site-packages/bob/bio/base/tools/command_line.py", line 284, in parse_config_file
create_configuration_file(parsers, args)
File "miniconda/envs/bob/lib/python3.7/site-packages/bob/bio/base/tools/command_line.py", line 578, in create_configuration_file
bob.io.base.create_directories_safe(os.path.dirname(args.create_configuration_file))
File "miniconda/envs/bob/lib/python3.7/site-packages/numpy/lib/utils.py", line 100, in newfunc
return func(*args, **kwds)
File "miniconda/envs/bob/lib/python3.7/site-packages/bob/io/base/__init__.py", line 104, in create_directories_safe
os.makedirs(directory, exist_ok=True)
File "miniconda/envs/bob/lib/python3.7/os.py", line 223, in makedirs
mkdir(name, mode)
FileNotFoundError: [Errno 2] No such file or directory: ''
The issue is that bob.io.base.create_directories_safe(os.path.dirname(args.create_configuration_file))
is called without checking whether os.path.dirname(args.create_configuration_file)
isn't empty.
There are two solutions to this issue:
- We add this check here.
- We correct this in
bob.io.base.create_directories_safe
and just skip empty strings.
Which option would you prefer?