My code is:
f=file('python3.mp3','wb') conn=urllib2.urlopen(stream_url) while True: f.write(conn.read(1024)) where stream_url is the url of a stream I'm saving to disk in mp3 format (python3.mp3).
The file successfully saves, but the while loop never terminates. I guess I'm a bit confused as to what the 'True' condition represents? Is it while the stream is playing? While the connection is open? I've tried adding conn.close() and f.close() within the while loop, but that throws errors because it seems like it's interrupting the writing process.