-1
有人可以帮我解释为什么它给这个TypeError?TypeError:*之后的参数encrypt()必须是一个序列,而不是NoneType
这里是check_args函数定义:(此代码是从欧文斯·斯蒂芬斯AES基于代码)
def check_args():
try:
if (len(sys.argv) != 4):
raise Exception()
elif (not os.path.isfile(sys.argv[1])):
raise Exception("Input file must exist")
elif (not sys.argv[3] in ['CBC', 'ECB']):
raise Exception("Block cipher mode should be ECB or CBC")
return (sys.argv[1], sys.argv[2], sys.argv[3])
except Exception as ex:
print ("Usage:", sys.argv[0], "full_path_to_input_image full_path_to_output_image ECB|CBC")
if len(ex.args) > 0:
print ("--" + str(ex))
sys.exit(1)
if __name__ == "__main__":
args = check_args()
encrypt(*args)
Traceback (most recent call last):
File " ", line 57, in <module>
encrypt(*args)
TypeError: encrypt() argument after * must be a sequence, not NoneType
'check_args'定义在哪里?请[编辑]您的问题以包含所有必要的代码。 –