Skip to content

Allow linking to sections on index#144

Merged
TomAugspurger merged 2 commits intodask:masterfrom
stsievert:index-link
Apr 13, 2020
Merged

Allow linking to sections on index#144
TomAugspurger merged 2 commits intodask:masterfrom
stsievert:index-link

Conversation

@stsievert
Copy link
Copy Markdown
Member

@stsievert stsievert commented Apr 12, 2020

What does this PR implement?
In Dask-ML, I want to link to the section titled with "Machine learning". This PR allows that, so links like http://examples.dask.org/#machine-learning will resolve to the correct section.

Reference issues/PRs
This motivation is with dask/dask-ml#642 (which depends on this PR).

@stsievert
Copy link
Copy Markdown
Member Author

This does have slightly different styling:

Screen Shot 2020-04-12 at 11 08 28 AM

@stsievert
Copy link
Copy Markdown
Member Author

The CI failure looks unrelated; the error is thrown in one of the Scikit-image notebooks cells on writing an image. Here's the traceback:

Details
------------------
import os
from skimage import data, io
output_filename = os.path.join('temp', 'astronaut.png')
io.imsave(output_filename, data.astronaut())
------------------
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-d9b70a345968> in <module>
      3
      4 output_filename = os.path.join('temp', 'astronaut.png')
----> 5 io.imsave(output_filename, data.astronaut())
~/miniconda/envs/test/lib/python3.7/site-packages/skimage/data/__init__.py in astronaut()
    129     """
    130
--> 131     return _load("astronaut.png")
    132
    133
~/miniconda/envs/test/lib/python3.7/site-packages/skimage/data/__init__.py in _load(f, as_gray)
     94     # we lazy import it here
     95     from ..io import imread
---> 96     return imread(_os.path.join(data_dir, f), plugin='pil', as_gray=as_gray)
     97
     98
~/miniconda/envs/test/lib/python3.7/site-packages/skimage/io/_io.py in imread(fname, as_gray, plugin, **plugin_args)
     46
     47     with file_or_url_context(fname) as fname:
---> 48         img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
     49
     50     if not hasattr(img, 'ndim'):
~/miniconda/envs/test/lib/python3.7/site-packages/skimage/io/manage_plugins.py in call_plugin(kind, *args, **kwargs)
    208                                (plugin, kind))
    209
--> 210     return func(*args, **kwargs)
    211
    212
~/miniconda/envs/test/lib/python3.7/site-packages/skimage/io/_plugins/pil_plugin.py in imread(fname, dtype, img_num, **kwargs)
     34         with open(fname, 'rb') as f:
     35             im = Image.open(f)
---> 36             return pil_to_ndarray(im, dtype=dtype, img_num=img_num)
     37     else:
     38         im = Image.open(fname)
~/miniconda/envs/test/lib/python3.7/site-packages/skimage/io/_plugins/pil_plugin.py in pil_to_ndarray(image, dtype, img_num)
     64     while 1:
     65         try:
---> 66             image.seek(i)
     67         except EOFError:
     68             break
~/miniconda/envs/test/lib/python3.7/site-packages/PIL/PngImagePlugin.py in seek(self, frame)
    746         for f in range(self.__frame + 1, frame + 1):
    747             try:
--> 748                 self._seek(f)
    749             except EOFError:
    750                 self.seek(last_frame)
~/miniconda/envs/test/lib/python3.7/site-packages/PIL/PngImagePlugin.py in _seek(self, frame, rewind)
    789
    790             try:
--> 791                 cid, pos, length = self.png.read()
    792             except (struct.error, SyntaxError):
    793                 break
AttributeError: 'NoneType' object has no attribute 'read'

@TomAugspurger
Copy link
Copy Markdown
Member

Looks like some issue upstream in pillow: python-pillow/Pillow#4509

I've pushed a commit pinning to 7.0.0 for now.

@TomAugspurger TomAugspurger merged commit 2b21375 into dask:master Apr 13, 2020
@TomAugspurger
Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants