I am working on a script that downloads various image files from the web and then does some processing on them using the PIL. The script uses urlretreive to dump the images to temporary files, and right now I'm just trying to open them in a viewer using the PIL image.show() method. Here is the relevant portion of the code:
def main():
link_queue = Queue.Queue()
image_queue = Queue.Queue()
links = get_image_links('test_search')
for link in links:
link_queue.put(link)
for image in xrange(len(links)):
#create image downloading threads
t = ImageDownloadingThread(link_queue, image_queue)
t.setDaemon(True)
t.start()
link_queue.join()
image_data = image_queue.get()
image_file, image_url = image_data[0][0], image_data[1][0]
#get the first image downloaded and take a look
image = Image.open(image_file)
image.show()
Unfortunately, while the temporary file seems to load OK (Image.open doesn't return any errors) I get nothing in the viewer when image.show() is called:
I have also tried opening local, non-temporary files, in case that was part of the problem and get the same result. The OS is Windows Vista 32 bit SP2. Any ideas on what might be going wrong?
See Question&Answers more detail:os