File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
mamonsu/plugins/system/linux Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -24,11 +24,19 @@ def dir_size(self, path):
2424 total_size = 0
2525 for dirpath , dirnames , filenames in tree :
2626 for file in filenames :
27- size = os .path .getsize (os .path .join (dirpath , file ))
28- if 0 < size < self .block_size :
29- size = round (size / self .block_size ) * self .block_size + self .block_size
27+ try :
28+ size = os .path .getsize (os .path .join (dirpath , file ))
29+ if 0 < size < self .block_size :
30+ size = round (size / self .block_size ) * self .block_size + self .block_size
31+ except FileNotFoundError as e :
32+ self .log .debug (str (e ))
33+ size = 0
3034 total_size += size
31- size = os .path .getsize (dirpath )
35+ try :
36+ size = os .path .getsize (dirpath )
37+ except FileNotFoundError as e :
38+ self .log .debug (str (e ))
39+ size = 0
3240 total_size += size
3341 return total_size
3442
You can’t perform that action at this time.
0 commit comments