Can't flush print when download open-uri

no one responded to this and i still can’t get it to work. please help. let me rephrase very simply:

downloading file with open_uri and can’t flush print to report download progress.

thanks,
-t0

···

I’m confused. why won’t this print? I tried flushing the $defout and $stdout as well as the source_file_io, but that doesn’t work either.

download

prioritized_locations.each do |location|
begin
source_file_io = File.open(self.source_path,‘w’)
remote_file = open(location)
while incoming = remote_file.read(512)
source_file_io.write(incoming)
# THIS WON’T THIS PRINT!!!
print “\ca{source_file_io.pos}KB/#{@source_size}KB”
end
rescue
puts “#{location} failed”
remote_file.close unless remote_file.nil?
source_file_io.close unless source_file_io.nil?
next # try next location
else
puts ’ Done.’
break # we got it
ensure
remote_file.close unless remote_file.nil?
source_file_io.close unless source_file_io.nil?
end
end

-t0

Received: Fri, 14 Nov 2003 10:30:45 +0900
And lo T. wrote:

(snip)
source_file_io.write(incoming)
# THIS WON’T THIS PRINT!!!
print “\ca{source_file_io.pos}KB/#{@source_size}KB”
STDOUT.flush

···
end

rescue
(/snip)