mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-08 09:28:41 +00:00
Catch exception in calc_free_space().
This commit is contained in:
parent
8f675ebacf
commit
49c09bf297
1 changed files with 4 additions and 1 deletions
|
@ -827,7 +827,10 @@ Space:") + " " + nice_free)
|
||||||
def calc_free_space(self, directory):
|
def calc_free_space(self, directory):
|
||||||
if not common.windows_check():
|
if not common.windows_check():
|
||||||
import statvfs
|
import statvfs
|
||||||
dir_stats = os.statvfs(directory)
|
try:
|
||||||
|
dir_stats = os.statvfs(directory)
|
||||||
|
except:
|
||||||
|
return 0
|
||||||
block_size = dir_stats[statvfs.F_BSIZE]
|
block_size = dir_stats[statvfs.F_BSIZE]
|
||||||
avail_blocks = dir_stats[statvfs.F_BAVAIL]
|
avail_blocks = dir_stats[statvfs.F_BAVAIL]
|
||||||
return long(block_size * avail_blocks)
|
return long(block_size * avail_blocks)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue