Skip to content

Commit f0827d9

Browse files
committed
use stderr for download output - fixes #274
1 parent 50f50db commit f0827d9

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

bonito/cli/download.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import os
66
import re
7+
import sys
78
from shutil import rmtree
89
from zipfile import ZipFile
910
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
@@ -45,7 +46,7 @@ def download(self):
4546

4647
# skip download if local file is found
4748
if self.exists(fname.strip('.zip')) and not self.force:
48-
print("[skipping %s]" % fname)
49+
print("[skipping %s]" % fname, file=sys.stderr)
4950
return
5051

5152
if self.exists(fname.strip('.zip')) and self.force:
@@ -58,7 +59,7 @@ def download(self):
5859
f.write(data)
5960
t.update(len(data))
6061

61-
print("[downloaded %s]" % fname)
62+
print("[downloaded %s]" % fname, file=sys.stderr)
6263

6364
# unzip .zip files
6465
if fname.endswith('.zip'):
@@ -68,7 +69,7 @@ def download(self):
6869

6970
# convert chunkify training files to bonito
7071
if fname.endswith('.hdf5'):
71-
print("[converting %s]" % fname)
72+
print("[converting %s]" % fname, file=sys.stderr)
7273
args = cargparser().parse_args([
7374
self.location(fname),
7475
self.location(fname).strip('.hdf5')
@@ -107,15 +108,15 @@ def main(args):
107108
if args.models or args.all:
108109

109110
if args.show:
110-
print("[available models]")
111+
print("[available models]", file=sys.stderr)
111112
for model in models:
112-
print(f" - {model}")
113+
print(f" - {model}", file=sys.stderr)
113114
else:
114-
print("[downloading models]")
115+
print("[downloading models]", file=sys.stderr)
115116
for model in models.values():
116117
File(__models__, model, args.force).download()
117118
if args.training or args.all:
118-
print("[downloading training data]")
119+
print("[downloading training data]", file=sys.stderr)
119120
for train in training:
120121
File(__data__, train, args.force).download()
121122

0 commit comments

Comments
 (0)