I'm using Python's unittest
library and all the tests succeed, but I still get a traceback and I can't understand how I can fix the problem.
........
----------------------------------------------------------------------
Ran 8 tests in 0.020s
OK
Traceback (most recent call last):
File "C:\Users\Paul\Desktop\bloomfilter\test_bloomfilter.py", line 85, in <module>
unittest.main()
File "C:\Programming\PythonX86\Python27\lib\unittest\main.py", line 95, in __init__
self.runTests()
File "C:\Programming\PythonX86\Python27\lib\unittest\main.py", line 231, in runTests
sys.exit(not self.result.wasSuccessful())
SystemExit: False
>>>
If there is no variable defined with that name you will get a NameError exception. To fix the problem, in Python 2, you can use raw_input() . This returns the string entered by the user and does not attempt to evaluate it. Note that if you were using Python 3, input() behaves the same as raw_input() does in Python 2.
Traceback (most recent call last)?This program is supposed to accept a number and print out all the numbers up to and including that number. When Python encounters an exception that isn't handled in your code, it will print out a traceback.
To avoid the end of execution traceback:
if __name__ == '__main__':
unittest.main(exit=False)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With