Test filelist databases when no zt files exist
Merge request reports
Activity
@mguenther is this a bug? I cannot call
db.all_files
on file list based databases with no ztnorm files.assigned to @mguenther
When having a look into the
all_files
function, you can clearly see that there is anadd_zt_files=True
option: https://gitlab.idiap.ch/bob/bob.bio.base/blob/45983b2d464abbf257e91746c91cfdc22d1c7f96/bob/bio/base/database/filelist/query.py#L204Your test case is, hence, wrong.
I know why it happens. Don't you think it's counter intuitive when you simply call
db.all_files()
it raises an exception? I am trying to use the database API outside bob.bio.base here. This filelist based database is trying to satisfy two datasets one with ztnorm and one without ztnorm. Can it issue a warning instead of raising an exception? or can we have something better that doesn't crash?I tried to check, what is the default for databases that come with ZT files by default, such as
bob.db.mobio
. Unfortunately, theall_files
option seems not to be present in this low-level dataset.I could automatically add the
zt_files
if they are available, and have the option working the other way round:remove_zt_files=False
. Then, I can issue a warning when this is set toTrue
and no zt-files are there.Having a look into how this function is used, I am afraid however that this would require more changes. We currently query the
database.all_files()
in theFileSelector
: https://gitlab.idiap.ch/bob/bob.bio.base/blob/45983b2d464abbf257e91746c91cfdc22d1c7f96/bob/bio/base/tools/FileSelector.py#L113 This has lately been introduced to solve #67 (closed).Anyways, the default implementation of
all_files
inbob.bio.base.databse.ZTBioDatabase
uses the same flag: https://gitlab.idiap.ch/bob/bob.bio.base/blob/45983b2d464abbf257e91746c91cfdc22d1c7f96/bob/bio/base/database/database.py#L645 which isTrue
by default. When you accidentally derive your high-level class fromZTBioDatabase
without providing ZT files, you get a similar error.So, this comes back to your suggestion, i.e., turning the exception into a warning. Yes, this should be possible. I will implement a patch.
added 1 commit
- 6c92c1ce - Turned exception of missing ZT files into a warning
assigned to @amohammadi
mentioned in commit 24f53216
I clicked on the merge button. Thanks @mguenther for the patch.