handle sys.stdin being None when using '-' as input file (#653)
This commit is contained in:
@@ -205,11 +205,13 @@ def main():
|
|||||||
if args.inputfile:
|
if args.inputfile:
|
||||||
try:
|
try:
|
||||||
if args.inputfile == "-":
|
if args.inputfile == "-":
|
||||||
file = sys.stdin
|
if sys.stdin:
|
||||||
|
urls += parse_inputfile(sys.stdin, log)
|
||||||
|
else:
|
||||||
|
log.warning("input file: stdin is not readable")
|
||||||
else:
|
else:
|
||||||
file = open(args.inputfile, encoding="utf-8")
|
with open(args.inputfile, encoding="utf-8") as file:
|
||||||
urls += parse_inputfile(file, log)
|
urls += parse_inputfile(file, log)
|
||||||
file.close()
|
|
||||||
except OSError as exc:
|
except OSError as exc:
|
||||||
log.warning("input file: %s", exc)
|
log.warning("input file: %s", exc)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user