[Matplotlib-devel] Possible bug in matplotlib versions 1.4 and higher with basemap arcgisimage imagery

Benjamin Root ben.v.root at gmail.com
Mon Jan 25 10:53:02 EST 2016


Yes, I recently noticed this, too. CC-ing Mike Droettboom, I think this is
caused by our recent changes to _image.cpp to add error-checking.

Ben Root

On Fri, Jan 22, 2016 at 3:43 AM, Mike Tercek via Matplotlib-devel <
matplotlib-devel at python.org> wrote:

> When I make a map with the basemap and try to insert a background image
> from acrgis servers, the following code works ok if I have maplotlib
> version 1.3.1 installed:
>
> m =
> Basemap(llcrnrlon=ll_lon,llcrnrlat=ll_lat,urcrnrlon=ur_lon,urcrnrlat=ur_lat,epsg=3857,lat_0=latz,lon_0=lonz,
> fix_aspect = False)
> m.arcgisimage(service='ESRI_Imagery_World_2D', xpixels = 2000, verbose=
> False, dpi = 80)
>
> However, if I have matplotlib version 1.4.3 installed I get the following
> error:
>
> Python 3.4.3 (default, Oct 14 2015, 20:28:29)
> [GCC 4.8.4] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> runfile('/media/mt/7670100C700FD1B3/vegviz/contain/xv.py',
> wdir=r'/media/mt/7670100C700FD1B3/vegviz/contain')
> Content-Type: text/html
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File
> "/usr/local/lib/python3.4/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py",
> line 680, in runfile
>     execfile(filename, namespace)
>   File
> "/usr/local/lib/python3.4/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py",
> line 85, in execfile
>     exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)
>   File "/media/mt/7670100C700FD1B3/vegviz/contain/xv.py", line 401, in
> <module>
>     m,fig =
> make_base_map(title,frame_bound,park_bound,inset,inset_location,inset_alignment,ll_lon,ll_lat,ur_lon,ur_lat,latz,lonz,True)
>   File "/media/mt/7670100C700FD1B3/vegviz/contain/xv.py", line 110, in
> make_base_map
>     m.arcgisimage(service='ESRI_Imagery_World_2D', xpixels = 2000,
> verbose= False, dpi = 80)
>   File
> "/usr/local/lib/python3.4/dist-packages/mpl_toolkits/basemap/__init__.py",
> line 4270, in arcgisimage
>     return
> self.imshow(imread(urllib.request.urlopen(basemap_url)),origin='upper')
>   File "/usr/local/lib/python3.4/dist-packages/matplotlib/image.py", line
> 1270, in imread
>     return handler(fname)
> RuntimeError: _image_module::readpng: file not recognized as a PNG file
>
> And if I install matplotlib 1.5.1, I get this error:
>
> Python 3.4.3 (default, Oct 14 2015, 20:28:29)
> [GCC 4.8.4] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> runfile('/media/mt/7670100C700FD1B3/vegviz/contain/xv.py',
> wdir=r'/media/mt/7670100C700FD1B3/vegviz/contain')
> Content-Type: text/html
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File
> "/usr/local/lib/python3.4/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py",
> line 680, in runfile
>     execfile(filename, namespace)
>   File
> "/usr/local/lib/python3.4/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py",
> line 85, in execfile
>     exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)
>   File "/media/mt/7670100C700FD1B3/vegviz/contain/xv.py", line 401, in
> <module>
>     m,fig =
> make_base_map(title,frame_bound,park_bound,inset,inset_location,inset_alignment,ll_lon,ll_lat,ur_lon,ur_lat,latz,lonz,True)
>   File "/media/mt/7670100C700FD1B3/vegviz/contain/xv.py", line 110, in
> make_base_map
>     m.arcgisimage(service='ESRI_Imagery_World_2D', xpixels = 2000,
> verbose= False, dpi = 80)
>   File
> "/usr/local/lib/python3.4/dist-packages/mpl_toolkits/basemap/__init__.py",
> line 4270, in arcgisimage
>     return
> self.imshow(imread(urllib.request.urlopen(basemap_url)),origin='upper')
>   File "/usr/local/lib/python3.4/dist-packages/matplotlib/image.py", line
> 1326, in imread
>     return handler(fname)
> SystemError: error return without exception set
>
>
>
> _______________________________________________
> Matplotlib-devel mailing list
> Matplotlib-devel at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20160125/d28d4042/attachment.html>


More information about the Matplotlib-devel mailing list