you want to use: 
while source_file is None:

instead.