-
Notifications
You must be signed in to change notification settings - Fork 207
Sphinx warns about not readable image file (although the image is found for html build) #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
As far I can see from the nilearn doc, we use things like:
Can you try to follow a pattern like this and see whether that fixes the warning? I am not going to claim I understand how sphinx works in detail, but at one point I understood that the _images folder was something that sphinx was creating automatically by looking at all the images referenced to and copying them there. It could well be that your image is referenced correctly in the example HTML causing it to end up in _images. This would kind of explain why the image is not found at sphinx generation time but shows up correctly in the HTML. |
Thank you so much for helping me dive into sphinx's black magics :-) ! It worked, warning fixed, made my day! |
Glad to hear that! Closing this issue then. |
That's closing an issue a bit fast, IMHO. The problem is that we had a My point is that sphinx-gallery is currently tricky to use because it Before we discard this issue, we need to figure out how to make sure that |
@GaelVaroquaux well, even pretty senior developers do silly mistakes from time to time. Here I only had to change the name of the image ( One problem that I have with sphinx (I guess I'm not the only one) is that it does a lot of magics about paths, filenames, references etc., so that I find it easy to get trapped in a local minimum of energy where you fixed some issues but you still didn't do it "the right way". Anyway, for this issue it was really more me being stupid than the problem of sphinx-gallery (of course the problem was triggered by the fact that I had to rename the file name, but...). The issue of #115 is much more serious IMO and might require a better solution than the quick fix of #119. |
OK, point taken. This issue is probably more with Sphinx than Sphinx
gallery.
One trick that I use to debug such issue, is that I am careful to flush
my build directory on a regular basis: it avoids having trailing files
that I no longer generate by Sphinx (which confused you, as you had an
error, but it seemed to be working).
Maybe we should have section on debugging issues with Sphinx and
Sphinx-gallery? As Sphinx-gallery adds an extra layer of complexity it
makes things even more difficult to debug.
|
To document a little bit the process of porting a project to sphinx-gallery, here are the most time-consuming steps that I had to take so far
All the rest was quite easy and well documented (what to add to |
@GaelVaroquaux I do |
Hum, should sphinx-gallery have a clean mechanism? We tend to think not,
because when switching from one branch to another in a project
development, we don't want to clean stuff that is valid in another
branch.
|
Yes we introduced the prefix in the images some versions ago in the _images directory is because sphinx copies all images to this
Yes Sphinx has a lot of black magic and issues in it, not only with
Yes, we prefixed generated images, is for the best. |
This is painful I agree, but your the # comments do seem cleaner. Since
Yes, everything generated by sphinx-gallery prefixes sphx_glr, |
One shall always make the links to the local files in the source
Yes, we want to cache as much of the gallery builds during There is on cleanup we do and is to remove all images generated by the |
@Titan-C thanks for the comments and explanations. About the comment style + renaming, my point was not to question the choices of |
I'm currently trying to port the doc of scikit-image to sphinx-gallery (see scikit-image/scikit-image#2078).
During the html build of the doc, sphinx issues the following warning (treated as error by CI):
sphx_glr_plot_camera_numpy_001.png
is generated by one of the examples of the gallery, and included innumpy_images.rst
asFrom the warning, it seems that the path is wrong, but the html page generated from the build displays correctly the image (and the link to the gallery example works too). Therefore, I don't understand the origin of the warning (and maybe I wouldn't mind it so much if didn't make our Travis CI fail :-)).
This path issue might be another facet of the problem of having a separated
source
directory, as also illustrated in #115, but I'm not sure whether that point matters here.The text was updated successfully, but these errors were encountered: