test wether the file exists before opening
This commit is contained in:
parent
897c3943c1
commit
6672e8d1d2
|
@ -125,6 +125,9 @@ if __name__ == "__main__":
|
||||||
parser.add_argument("-n", "--number", default=10, help="number of questions to ask", type=int, action="store")
|
parser.add_argument("-n", "--number", default=10, help="number of questions to ask", type=int, action="store")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
filepath = pathlib.Path(args.file)
|
filepath = pathlib.Path(args.file)
|
||||||
|
if not filepath.exists():
|
||||||
|
print("no such file!")
|
||||||
|
exit(1)
|
||||||
interface = Tui()
|
interface = Tui()
|
||||||
app = Application(filepath, interface, args.number)
|
app = Application(filepath, interface, args.number)
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue