What you're looking for is disabling Exception Chaining with from None
1.
Change your raise
statement to
raise InvalidValueError("%s is not a valid base10 number." % number) from None
and only your custom exception will be raised, without reference to the ValueError exception originally caught.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…