|
From: Jerzy K. <jer...@un...> - 2015-03-20 19:58:01
|
Le 20/03/2015 16:57, Ryan Nelson a écrit : > For me, if I change the script from the PR to what is shown below, > everything works fine in both Python 2.7 and 3.4 (Anaconda > environments, everything updated): > ################## > url = 'http://www.libpng.org/pub/png/img_png/pngnow.png' > try: > import urllib2 > data = urllib2.urlopen(url) > except Exception: > import urllib.request > from io import BytesIO > data = BytesIO(urllib.request.urlopen(url).read()) > > from matplotlib import pyplot > > image = pyplot.imread(data) # crash on py3.x > pyplot.imshow(image) > pyplot.show() > ################# > But as you can see, the Python 3 version requires the addition of > BytesIO and read(). I take it that this is not supposed to be the case. It works for X.png, not for X.jpg. The call of imread() fails then. Tested also under 3.4/Anaconda. Jerzy Karczmarczuk |