raise IndexError('index {} is out of range'.format(idx))
IndexError: index 1 is out of range
出现问题的地方实在container.py中:
def _get_abs_string_index(self, idx):
"""Get the absolute index for the list of modules"""
idx = operator.index(idx)
print(idx)
if not (-len(self) <= idx < len(self)):#这里
raise IndexError('index {} is out of range'.format(idx))
if idx < 0:
idx += len(self)
return str(idx)
raise IndexError('index {} is out of range'.format(idx))
IndexError: index 1 is out of range
出现问题的地方实在container.py中:
def _get_abs_string_index(self, idx):
"""Get the absolute index for the list of modules"""
idx = operator.index(idx)
print(idx)
if not (-len(self) <= idx < len(self)):#这里
raise IndexError('index {} is out of range'.format(idx))
if idx < 0:
idx += len(self)
return str(idx)