-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'定義在哪裏?請[編輯]您的問題以包含所有必要的代碼。 –