forked from M-Labs/artiq
afws_client: improve error message when output already exists
This commit is contained in:
parent
cc69482dad
commit
b6f5ba8b5b
|
@ -132,9 +132,13 @@ def main():
|
||||||
try:
|
try:
|
||||||
os.mkdir(args.directory)
|
os.mkdir(args.directory)
|
||||||
except FileExistsError:
|
except FileExistsError:
|
||||||
|
try:
|
||||||
if any(os.scandir(args.directory)):
|
if any(os.scandir(args.directory)):
|
||||||
print("Output directory already exists and is not empty. Please remove it and try again.")
|
print("Output directory already exists and is not empty. Please remove it and try again.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
except NotADirectoryError:
|
||||||
|
print("A file with the same name as the output directory already exists. Please remove it and try again.")
|
||||||
|
sys.exit(1)
|
||||||
rev = args.rev
|
rev = args.rev
|
||||||
if rev is None:
|
if rev is None:
|
||||||
rev = get_artiq_rev()
|
rev = get_artiq_rev()
|
||||||
|
|
Loading…
Reference in New Issue