Skip to content

Commit

Permalink
Fix a FileNotFound issue
Browse files Browse the repository at this point in the history
  • Loading branch information
allejok96 committed Sep 8, 2017
1 parent 675036b commit 1b74b46
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions jwlib/arguments.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import shutil
from os import makedirs
from shutil import disk_usage
from sys import stderr
from argparse import SUPPRESS

Expand Down Expand Up @@ -82,7 +83,11 @@ def disk_usage_info(wd, keep_free: int, warn=True, quiet=0):
:param warn: Show warning when keep_free seems too low
:param quiet: Show disk usage information
"""
free = shutil.disk_usage(wd).free
# We create a directory here to prevent FileNotFoundError
# if someone specified --free without --download they are dumb
makedirs(wd,exist_ok=True)
free = disk_usage(wd).free

if quiet == 0:
print('free space: {:} MiB, minimum limit: {:} MiB'.format(free//1024**2, keep_free//1024**2), file=stderr)

Expand Down

0 comments on commit 1b74b46

Please sign in to comment.