我正在将我的子函数之一导入到我的主脚本中,并且我一直得到以下内容:
IndexError: list index out of range
我在脚本中实现与函数要求相同的函数调用。有人知道一种方法来检查,看看函数是否正确导入?
下面是我使用
的代码示例from file_with_function import function
[output1 output2 output3] = function(roll = 15, pitch = 30,
yaw = 45)
print('Argument List: '+ str(sys.argv))
rolla = int(sys.argv[1])
pitcha = int(sys.argv[2])
yawa = int(sys.argv[3])
def function(roll = 15 , pitch = 30 , yaw = 45):
#script is here
if __name__ =='__main__':
function(
roll = rolla,
pitch = pitcha,
yaw = yawa)
您试图导入的函数中有错误,或者您传递给函数的数据有问题。我不认为这是一个导入错误,但如果不看代码,我无法真正帮助你。