Want more features on Pastebin? Sign Up, it's FREE!
Guest

UnsupportedOperation: seek

By: pleabargain on Jun 8th, 2013  |  syntax: Python  |  size: 1.06 KB  |  views: 50  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. import tkinter as tk
  3.  
  4. from urllib.request import urlopen
  5. from PIL import ImageTk, Image
  6.  
  7. image = urlopen('https://www.google.com/images/srpr/logo4w.png')
  8. resized_image = Image.open(image)
  9.  
  10. root = tk.Tk()
  11. img = ImageTk.PhotoImage(resized_image)
  12. panel = tk.Label(root, image=img)
  13. panel.pack(side="bottom", fill="both", expand="yes")
  14. root.mainloop()
  15. ---------------------------------------------------------------------------
  16. UnsupportedOperation                      Traceback (most recent call last)
  17. <ipython-input-2-895b591b58f6> in <module>()
  18.       5
  19.       6 image = urlopen('https://www.google.com/images/srpr/logo4w.png')
  20. ----> 7 resized_image = Image.open(image)
  21.       8
  22.       9 root = tk.Tk()
  23.  
  24. /usr/local/lib/python3.2/dist-packages/PIL/Image.py in open(fp, mode)
  25.    1998             factory, accept = OPEN[i]
  26.    1999             if not accept or accept(prefix):
  27. -> 2000                 fp.seek(0)
  28.    2001                 return factory(fp, filename)
  29.    2002         except (SyntaxError, IndexError, TypeError):
  30.  
  31. UnsupportedOperation: seek
clone this paste RAW Paste Data