If your code is exactly what you've copy-pasted, then you are not testing against an empty string but a "one blank space" string ...
I've just tried with : while line != "": and it works very well. -- http://mail.python.org/mailman/listinfo/python-list