@@ -341,6 +341,9 @@ def collect_path(
341
341
path = self .target .fs .path (path )
342
342
343
343
try :
344
+ # If a path does not exist, is_dir(), is_file() and is_symlink() will return False (and not raise an
345
+ # exception), so we need to explicitly check for this.
346
+ exists = self .target .fs .lexists (path )
344
347
is_dir = path .is_dir ()
345
348
is_file = path .is_file ()
346
349
is_symlink = path .is_symlink ()
@@ -360,19 +363,23 @@ def collect_path(
360
363
self .report .add_path_failed (module_name , path )
361
364
return
362
365
363
- if is_dir :
364
- self .collect_dir (path , seen_paths = seen_paths , module_name = module_name )
365
- elif is_file :
366
- self .collect_file (path , module_name = module_name )
367
- elif is_symlink :
368
- log .error (
369
- "- Can't collect %s (symlink to %s) in module %s" ,
370
- path ,
371
- path .get ().readlink (),
372
- module_name ,
373
- )
366
+ if exists :
367
+ if is_dir :
368
+ self .collect_dir (path , seen_paths = seen_paths , module_name = module_name )
369
+ elif is_file :
370
+ self .collect_file (path , module_name = module_name )
371
+ elif is_symlink :
372
+ log .error (
373
+ "- Can't collect %s (symlink to %s) in module %s" ,
374
+ path ,
375
+ path .get ().readlink (),
376
+ module_name ,
377
+ )
378
+ else :
379
+ log .error ("- Don't know how to collect %s in module %s" , path , module_name )
374
380
else :
375
- log .error ("- Don't know how to collect %s in module %s" , path , module_name )
381
+ self .report .add_path_missing (module_name , path )
382
+ log .error ("- Path %s is not found" , path )
376
383
377
384
def collect_command_output (
378
385
self ,
0 commit comments