matplotlib / matplotlib/basemap

Fail on basemap.drawcounties() Python 3.5.2

Open
#324 23 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
817
Forks
395
PR merge metrics
No merged PRs in 30d

Description

Platform:

```
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:53:06)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
```

Throws error on basemap.drawcounties() (over Illinois)

```
Traceback (most recent call last):
File "animate_aws.py", line 171, in
writer='imagemagick', fps=5)
File "/home/scollis/anaconda/envs/pyart35/lib/python3.5/site-packages/matplotlib/animation.py", line 832, in save
anim._init_draw()
File "/home/scollis/anaconda/envs/pyart35/lib/python3.5/site-packages/matplotlib/animation.py", line 1221, in _init_draw
self._draw_frame(next(self.new_frame_seq()))
File "/home/scollis/anaconda/envs/pyart35/lib/python3.5/site-packages/matplotlib/animation.py", line 1243, in _draw_frame
self._drawn_artists = self._func(framedata, *self._args)
File "animate_aws.py", line 166, in animate
display.basemap.drawcounties()
File "/home/scollis/anaconda/envs/pyart35/lib/python3.5/site-packages/mpl_toolkits/basemap/__init__.py", line 1980, in drawcounties
default_encoding='latin-1',drawbounds=drawbounds)
File "/home/scollis/anaconda/envs/pyart35/lib/python3.5/site-packages/mpl_toolkits/basemap/__init__.py", line 2146, in readshapefile
for shprec in shf.shapeRecords():
File "/home/scollis/anaconda/envs/pyart35/lib/python3.5/site-packages/mpl_toolkits/basemap/shapefile.py", line 543, in shapeRecords
for rec in zip(self.shapes(), self.records())]
File "/home/scollis/anaconda/envs/pyart35/lib/python3.5/site-packages/mpl_toolkits/basemap/shapefile.py", line 515, in records
r = self.__record()
File "/home/scollis/anaconda/envs/pyart35/lib/python3.5/site-packages/mpl_toolkits/basemap/shapefile.py", line 491, in __record
value = u(value)
File "/home/scollis/anaconda/envs/pyart35/lib/python3.5/site-packages/mpl_toolkits/basemap/shapefile.py", line 58, in u
return v.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf1 in position 2: invalid continuation byte
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with mpl_toolkits/basemap/shapefile.py, following records() and __record() from the reported drawcounties() traceback. Reproduce the Illinois drawcounties() call in the reported Python 3.5.2 environment and trace the encoding failure; done means the call completes without the UnicodeDecodeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.