diff --git a/intelmq/bots/experts/asn_lookup/expert.py b/intelmq/bots/experts/asn_lookup/expert.py index 008e291dc..6b1cf5bf5 100644 --- a/intelmq/bots/experts/asn_lookup/expert.py +++ b/intelmq/bots/experts/asn_lookup/expert.py @@ -123,10 +123,12 @@ def update_database(cls, verbose=False): raise MissingDependencyError("pyasn") for database_path in set(bots.values()): - if not Path(database_path).is_file(): - raise ValueError('Database file does not exist or is not a file.') - elif not os.access(database_path, os.W_OK): - raise ValueError('Database file is not writeable.') + database_file = Path(database_path) + if database_file.is_file(): + # File exists, check if it's writeable + if not os.access(database_path, os.W_OK): + raise ValueError('Database file is not writeable.') + # If file doesn't exist, the directory will be created later when downloading try: if verbose: