Added more error handling when using as main file
This commit is contained in:
1 parent
959c9b79be
commit
2a13faacec
1 file changed
+6
-2
@@ -85,5 +85,9 @@ if __name__ == "__main__":
|
|||||||
if (len(argv) < 2):
|
if (len(argv) < 2):
|
||||||
print('Usage: python main.py "Server name" 127.0.0.1')
|
print('Usage: python main.py "Server name" 127.0.0.1')
|
||||||
exit(1)
|
exit(1)
|
||||||
print(f"Creating file using arguments {argv[1:]}")
|
print(f"Creating file using arguments '{', '.join(argv[1:])}'")
|
||||||
write_file(*argv[1:], log_bytes=True)
|
try:
|
||||||
|
write_file(*argv[1:], log_bytes=True)
|
||||||
|
except Exception as error:
|
||||||
|
print("Error:", error)
|
||||||
|
exit(2)
|
||||||
Reference in new issue
Block a user