Skip to content

import error buried with blanket exception  #60

@SBFRF

Description

@SBFRF

So i was helping my co-worker install this package and ran into espg code errors relating to basemap. After some thorough digging i was able to isolate this issue to a missing install from basemap high res. The code throwing the error is below

try:
   print("Checking the epsg code you have chosen for compatibility with Basemap ... ")
   from mpl_toolkits.basemap import Basemap # ERROR Thrown on this line
   m = Basemap(projection='merc', epsg=cs2cs_args.split(':')[1],
      resolution = 'i', llcrnrlon=10, llcrnrlat=10, urcrnrlon=30, urcrnrlat=30)
   del m
   print("... epsg code compatible")
except:
   print("Error: the epsg code you have chosen is not compatible with Basemap")
   print("please choose a different epsg code (http://spatialreference.org/)")
   print("program will now close")
   sys.exit()

The blanket exception was suppressing the output that provided information helping with install

Traceback (most recent call last):
  File "/home/frfuser/anaconda2/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2878, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-5-21da07c7665c>", line 2, in <module>
    resolution = 'i', llcrnrlon=10, llcrnrlat=10, urcrnrlon=30, urcrnrlat=30)
  File "/home/frfuser/anaconda2/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py", line 1122, in __init__
    self._readboundarydata('gshhs',as_polygons=True)
 File "/home/frfuser/anaconda2/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py", line 1236, in _readboundarydata
    raise IOError(msg)
IOError: Unable to open boundary dataset file. Only the 'crude' and  'low',
resolution datasets are installed by default.
If you are requesting an, 'intermediate', 'high' or 'full'
resolution dataset, you may need to download and install those
files separately with
`conda install basemap-data-hires`.``

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions