Title: [Bug]: plot_directive does not raise warning or error when the code it runs fails · Issue #30899 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: plot_directive does not raise warning or error when the code it runs fails · Issue #30899 · matplotlib/matplotlib
X Title: [Bug]: plot_directive does not raise warning or error when the code it runs fails · Issue #30899 · matplotlib/matplotlib
Description: Bug summary When the plot directive is used on code that fails, plot directive silently accepts it (no figure is produced) by proceeding like nothing went wrong. Code for reproduction The following 1D Regular Binning ^^^^^^^^^^^^^^^^^^ ....
Open Graph Description: Bug summary When the plot directive is used on code that fails, plot directive silently accepts it (no figure is produced) by proceeding like nothing went wrong. Code for reproduction The following...
X Description: Bug summary When the plot directive is used on code that fails, plot directive silently accepts it (no figure is produced) by proceeding like nothing went wrong. Code for reproduction The following...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/30899
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: plot_directive does not raise warning or error when the code it runs fails","articleBody":"### Bug summary\n\nWhen the plot directive is used on code that fails, plot directive silently accepts it (no figure is produced) by proceeding like nothing went wrong.\n\n### Code for reproduction\n\n```Python\nThe following\n\n\n1D Regular Binning\n^^^^^^^^^^^^^^^^^^\n\n.. plot::\n :include-source:\n\n raise RuntimeWarning('I will break')\n```\n\n### Actual outcome\n\n\u003cimg width=\"1518\" height=\"284\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/7e62a672-863e-4b96-b272-92a4bbfca371\" /\u003e\n\n### Expected outcome\n\nI expect to see a warning or error when building the docs via `sphinx`\n\n```\n$ python -m sphinx ./ ./_build --fail-on-warning -T\nRunning Sphinx v8.2.3\nloading translations [en]... done\nConverting `source_suffix = ['.rst', '.md']` to `source_suffix = {'.rst': 'restructuredtext', '.md': 'restructuredtext'}`.\nloading pickled environment... checking bibtex cache... up to date\nThe configuration has changed (3 options: 'html_css_files', 'html_static_path', 'pygments_dark_style')\ndone\nmyst v4.0.1: MdParserConfig(commonmark_only=False, gfm_only=False, enable_extensions={'colon_fence'}, disable_syntax=[], all_links_external=False, links_external_new_tab=False, url_schemes=('http', 'https', 'mailto', 'ftp'), ref_domains=None, fence_as_directive=set(), number_code_blocks=[], title_to_header=False, heading_anchors=0, heading_slug_func=None, html_meta={}, footnote_sort=True, footnote_transition=True, words_per_minute=200, substitutions={}, linkify_fuzzy_links=True, dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, dmath_double_inline=False, update_mathjax=True, mathjax_classes='tex2jax_process|mathjax_process|math|output_area', enable_checkboxes=False, suppress_warnings=[], highlight_code_blocks=True)\n[autosummary] generating autosummary for: CODE_OF_CONDUCT.md, CONTRIBUTING.md, _generated/pyhs3.Model.rst, _generated/pyhs3.Workspace.rst, _generated/pyhs3.analyses.Analyses.rst, _generated/pyhs3.analyses.Analysis.rst, _generated/pyhs3.analyses.rst, _generated/pyhs3.base.Evaluable.rst, _generated/pyhs3.data.Axis.rst, _generated/pyhs3.data.BinnedData.rst, ..., broadcasting.rst, defining_components.rst, development.rst, index.rst, model.rst, structure.rst, talks.rst, testing.rst, visualization.rst, workspace.rst\n```\n\n### Additional information\n\n```\nmatplotlib 3.10.3\nmatplotlib-inline 0.1.7\nSphinx 8.2.3\n```\n\n### Operating system\n\nOS/X [Sonoma, 14.7.6 (23H626)]\n\n### Matplotlib Version\n\n3.10.3\n\n### Matplotlib Backend\n\nAgg\n\n### Python version\n\nPython 3.13.0\n\n### Jupyter version\n\nn/a\n\n### Installation\n\npip","author":{"url":"https://github.com/kratsg","@type":"Person","name":"kratsg"},"datePublished":"2025-12-25T17:29:27.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":12},"url":"https://github.com/30899/matplotlib/issues/30899"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:21caae5b-b078-8563-fc0e-3ec3e18136d3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8994:108FC:1947625:21FB1A9:6A535BDD |
| html-safe-nonce | 7ac8111f6609440082dc035c7708106f9f888ab28cab5fa6397ce0ab97f256f0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTk0OjEwOEZDOjE5NDc2MjU6MjFGQjFBOTo2QTUzNUJERCIsInZpc2l0b3JfaWQiOiI1MjgwMTM1NTQ4ODM2NzMxODY5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 7f6c34489d4a59e22894b6b369af150541236010c83eb641ffbf3b634399a8f9 |
| hovercard-subject-tag | issue:3762222664 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/30899/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4863116a7bccb123e244c29693a27312d420f5c93d31a1ecc020609c8da32ba7/matplotlib/matplotlib/issues/30899 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4863116a7bccb123e244c29693a27312d420f5c93d31a1ecc020609c8da32ba7/matplotlib/matplotlib/issues/30899 |
| og:image:alt | Bug summary When the plot directive is used on code that fails, plot directive silently accepts it (no figure is produced) by proceeding like nothing went wrong. Code for reproduction The following... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kratsg |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width