Skip to content
This repository has been archived by the owner on May 31, 2023. It is now read-only.

Commit

Permalink
Creating the samples dir automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
neriberto committed Dec 13, 2018
1 parent 7c1d5b0 commit e508ab2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ async def download_samples(q):
@click.option('--repo', default=SAMPLES_PATH, help='The directory to store files')
def cli(repo):
try:
if repo and os.path.isdir(repo):
SAMPLES_PATH = repo
else:
print("Directory inexistent %s" % repo)
sys.exit()
if not os.path.isdir(repo):
print("Creating directory %s" % repo)
os.makedirs(repo)

SAMPLES_PATH = repo

print("Storing files in %s" % SAMPLES_PATH)
ioloop = asyncio.get_event_loop()
Expand All @@ -67,7 +67,9 @@ def cli(repo):
ioloop.run_until_complete(asyncio.gather(producer, consumer))
ioloop.close()
except KeyboardInterrupt:
sys.exit()
pass
except PermissionError as ex:
print(ex)
except SystemExit:
pass

Expand Down

0 comments on commit e508ab2

Please sign in to comment.