I'm building a simple CLI tool for cryptography using Python's argparse module. One of the features is base64 encoding. However, when I run this command: python crypto.py --encode base64 hello It prints the result twice: encoded to base64 : aGVsbG8= encoded to base64 : aGVsbG8= This is the code snippet # crypto.py import argparse import base64 parser = argparse.ArgumentParser(prog="CryptoTool") parser.add_argument("-en", "--encode", help="encode your input") parser.add_argument("input", nargs="?", help="input text") args = parser.parse_args() inp = args.input if args.input else input("Enter input: ") if args.encode == "base64": encoded = base64.b64encode(inp.encode()).decode() print(f"encoded to base64 : {encoded}") I'm not sure if this is a logic error or something related to my IDE (I'm using VS Code). Also tried to run it in CMD rather than VS Code terminal still the result is same, How can I fix this. Continue reading...