On 04/02/15 09:01, Андрей Пугачев wrote:
Code doing all right, but in the end I have error Traceback (most recent call last): File "trivia_challenge.py", line 81, in <module> main() File "trivia_challenge.py", line 74, in main category, question, answers, correct, explanation, points = next_block(trivia_file) File "trivia_challenge.py", line 37, in next_block points = int(next_line(the_file)) ValueError: invalid literal for int() with base 10: '' I see it don't like empty line, but line is not emty...
OK, But what is it? Does it contain any spaces or letters or punctuation characters?
Try separating out the line and then adding a try/except like so: try: line = next_line(the_file) points = int(line) except ValueError: print "Line causing error is: \n;", repr(line) raise That way you will see exactly what causes the exception. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor