On Fri, Jun 24, 2011 at 8:56 AM, Vincent Balmori <vincentbalm...@yahoo.com>wrote:
> > <<<try: > > point = int(next_line(the_file)) > > If x is a string that can be interpreted as an integer number, int(x) is > that integer number; if the string is not the representation of an integer, > this will lead to a ValueError. > > -- > André Engels, andreeng...@gmail.com>>> > > > It's working fine now with the scoring, but now at the end of the program > for some reason I get this error message: > > Traceback (most recent call last): > File > > "/Users/vincentbalmori/Desktop/Python/py3e_source/chapter07/trivia_challenge2.py", > line 83, in <module> > main() > File > > "/Users/vincentbalmori/Desktop/Python/py3e_source/chapter07/trivia_challenge2.py", > line 76, in main > category, point, question, answers, correct, explanation = > next_block(trivia_file) > File > > "/Users/vincentbalmori/Desktop/Python/py3e_source/chapter07/trivia_challenge2.py", > line 27, in next_block > point = int(next_line(the_file)) > ValueError: invalid literal for int() with base 10: '' > > The important thing in such a case is reading the error message and the last line in the error trace. In this case the error message is: ValueError: invalid literal for int() with base 10: '' This means that the int() function is being called with something that is not an integer - it even says what that something is, namely '' - that is, the empty string. Apparently at some time you come to the line point = int(next_line(the_file)) when next_line(the_file) is the empty string. -- André Engels, andreeng...@gmail.com
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor