python - how can I display a image from web?
<p>I'm using Python to make a "web album viewer", but I meet some problem.</p>

<p>I use Tkinter to write GUI, urllib2 to fetch the image from web, PIL to handle the image</p>

<p>So the code is like this:</p>

<pre><code>root = Tk()
frame = Frame(root)
frame.pack()
response = urllib2.urlopen(a_pic_url)
photo = ImageTk.PhotoImage(Image.open(response.read()))
label = Label(frame, image = photo)
label.pack()
</code></pre>

<p>it fails, and throws the following error message:</p>

<pre><code>TypeError: file() argument 1 must be (encoded string without NULL bytes), not str
</code></pre>

<p>How can I overcome this?</p>

<p>Thanks, and I'm sorry for my poor English.</p>
