{"action":"created","comment":{"url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/pulls/comments/69395935","id":69395935,"diff_hunk":"@@ -575,80 +589,66 @@ def generate_file_rst(fname, target_dir, src_dir, gallery_conf):\n     image_fname = 'sphx_glr_' + base_image_name + '_{0:03}.png'\n     image_path_template = os.path.join(image_dir, image_fname)\n \n-    script_blocks = split_code_and_text_blocks(example_file)\n-\n-    # read specification of the figure to display as thumbnail from main text\n-    _, content = get_docstring_and_rest(example_file)\n-    thumbnail_number = extract_thumbnail_number(content)\n-\n-    amount_of_code = sum([len(bcontent)\n-                          for blabel, bcontent in script_blocks\n-                          if blabel == 'code'])\n-\n-    first_image_path = image_path_template.format(1)\n-    if _plots_are_current(example_file, first_image_path):\n-        return amount_of_code, 0\n-\n-    time_elapsed = 0\n-\n+    example_file = os.path.join(target_dir, fname)\n+    shutil.copyfile(src_file, example_file)\n     ref_fname = example_file.replace(os.path.sep, '_')\n     example_rst = \"\"\"\\n\\n.. _sphx_glr_{0}:\\n\\n\"\"\".format(ref_fname)\n     example_nb = Notebook(fname, target_dir)\n \n     filename_pattern = gallery_conf.get('filename_pattern')\n-    if re.search(filename_pattern, src_file) and gallery_conf['plot_gallery']:\n-        example_globals = {\n-            # A lot of examples contains 'print(__doc__)' for example in\n-            # scikit-learn so that running the example prints some useful\n-            # information. Because the docstring has been separated from\n-            # the code blocks in sphinx-gallery, __doc__ is actually\n-            # __builtin__.__doc__ in the execution context and we do not\n-            # want to print it\n-            '__doc__': '',\n-            # Examples may contain if __name__ == '__main__' guards\n-            # for in example scikit-learn if the example uses multiprocessing\n-            '__name__': '__main__'}\n-\n-        fig_count = 0\n-        # A simple example has two blocks: one for the\n-        # example introduction/explanation and one for the code\n-        is_example_notebook_like = len(script_blocks) > 2\n-        for blabel, bcontent in script_blocks:\n-            if blabel == 'code':\n-                code_output, rtime, fig_count = execute_script(bcontent,\n-                                                               example_globals,\n-                                                               image_path_template,\n-                                                               fig_count,\n-                                                               src_file,\n-                                                               gallery_conf)\n-\n-                time_elapsed += rtime\n-                example_nb.add_code_cell(bcontent)\n-\n-                if is_example_notebook_like:\n-                    example_rst += codestr2rst(bcontent) + '\\n'\n-                    example_rst += code_output\n-                else:\n-                    example_rst += code_output\n-                    if 'sphx-glr-script-out' in code_output:\n-                        # Add some vertical space after output\n-                        example_rst += \"\\n\\n|\\n\\n\"\n-                    example_rst += codestr2rst(bcontent) + '\\n'\n-\n-            else:\n-                example_rst += text2string(bcontent) + '\\n'\n-                example_nb.add_markdown_cell(text2string(bcontent))\n-    else:\n-        for blabel, bcontent in script_blocks:\n-            if blabel == 'code':\n+    execute_script = re.search(filename_pattern, src_file) and gallery_conf[\n+        'plot_gallery']\n+    example_globals = {\n+        # A lot of examples contains 'print(__doc__)' for example in\n+        # scikit-learn so that running the example prints some useful\n+        # information. Because the docstring has been separated from\n+        # the code blocks in sphinx-gallery, __doc__ is actually\n+        # __builtin__.__doc__ in the execution context and we do not\n+        # want to print it\n+        '__doc__': '',\n+        # Examples may contain if __name__ == '__main__' guards\n+        # for in example scikit-learn if the example uses multiprocessing\n+        '__name__': '__main__',\n+        # Keeps track of generated figures\n+        '__fig_count__': 0,\n+        '__example_has_failed__': not execute_script,","path":"sphinx_gallery/gen_rst.py","position":320,"original_position":323,"commit_id":"04672f2e63e38243b361548d879ccc286e8a37e9","original_commit_id":"ece117d2f525f079d37e7dc000746a86f0043e21","user":{"login":"Titan-C","id":713451,"avatar_url":"https://avatars.githubusercontent.com/u/713451?v=3","gravatar_id":"","url":"https://api.github.com/users/Titan-C","html_url":"https://github.com/Titan-C","followers_url":"https://api.github.com/users/Titan-C/followers","following_url":"https://api.github.com/users/Titan-C/following{/other_user}","gists_url":"https://api.github.com/users/Titan-C/gists{/gist_id}","starred_url":"https://api.github.com/users/Titan-C/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Titan-C/subscriptions","organizations_url":"https://api.github.com/users/Titan-C/orgs","repos_url":"https://api.github.com/users/Titan-C/repos","events_url":"https://api.github.com/users/Titan-C/events{/privacy}","received_events_url":"https://api.github.com/users/Titan-C/received_events","type":"User","site_admin":false},"body":"Indeed is hacky. But It looks to me that it is a nicer way to control the execution of examples and parsing of rst files that all the if statements before. If you roll back before changing this logic, `html-noplot` also gives the error.\r\nRegarding the `html-noplot` I think is better to avoid enforcing this failure control in this case, what do you think?.","created_at":"2016-07-03T18:59:54Z","updated_at":"2016-07-03T18:59:55Z","html_url":"https://github.com/sphinx-gallery/sphinx-gallery/pull/97#discussion_r69395935","pull_request_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/pulls/97","_links":{"self":{"href":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/pulls/comments/69395935"},"html":{"href":"https://github.com/sphinx-gallery/sphinx-gallery/pull/97#discussion_r69395935"},"pull_request":{"href":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/pulls/97"}}},"pull_request":{"url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/pulls/97","id":59302062,"html_url":"https://github.com/sphinx-gallery/sphinx-gallery/pull/97","diff_url":"https://github.com/sphinx-gallery/sphinx-gallery/pull/97.diff","patch_url":"https://github.com/sphinx-gallery/sphinx-gallery/pull/97.patch","issue_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/issues/97","number":97,"state":"open","locked":false,"title":"[MRG] Exitcodes","user":{"login":"Titan-C","id":713451,"avatar_url":"https://avatars.githubusercontent.com/u/713451?v=3","gravatar_id":"","url":"https://api.github.com/users/Titan-C","html_url":"https://github.com/Titan-C","followers_url":"https://api.github.com/users/Titan-C/followers","following_url":"https://api.github.com/users/Titan-C/following{/other_user}","gists_url":"https://api.github.com/users/Titan-C/gists{/gist_id}","starred_url":"https://api.github.com/users/Titan-C/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Titan-C/subscriptions","organizations_url":"https://api.github.com/users/Titan-C/orgs","repos_url":"https://api.github.com/users/Titan-C/repos","events_url":"https://api.github.com/users/Titan-C/events{/privacy}","received_events_url":"https://api.github.com/users/Titan-C/received_events","type":"User","site_admin":false},"body":"This expands the behavior towards failing examples.\r\n\r\nCloses #88, as examples that fail are stopped from execution to avoid noise in output.\r\n\r\nCloses #95. Failed examples are accumulated internally. At build finished they exit with 1.\r\nError messages are now in STDERR","created_at":"2016-02-14T18:30:23Z","updated_at":"2016-07-03T18:59:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5b39aca266b764e12113ca963378a324fc89f16d","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/milestones/2","html_url":"https://github.com/sphinx-gallery/sphinx-gallery/milestones/Release%20v0.1.3","labels_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/milestones/2/labels","id":1595670,"number":2,"title":"Release v0.1.3","description":null,"creator":{"login":"Titan-C","id":713451,"avatar_url":"https://avatars.githubusercontent.com/u/713451?v=3","gravatar_id":"","url":"https://api.github.com/users/Titan-C","html_url":"https://github.com/Titan-C","followers_url":"https://api.github.com/users/Titan-C/followers","following_url":"https://api.github.com/users/Titan-C/following{/other_user}","gists_url":"https://api.github.com/users/Titan-C/gists{/gist_id}","starred_url":"https://api.github.com/users/Titan-C/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Titan-C/subscriptions","organizations_url":"https://api.github.com/users/Titan-C/orgs","repos_url":"https://api.github.com/users/Titan-C/repos","events_url":"https://api.github.com/users/Titan-C/events{/privacy}","received_events_url":"https://api.github.com/users/Titan-C/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":1,"state":"open","created_at":"2016-02-21T16:16:26Z","updated_at":"2016-04-17T18:54:51Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/pulls/97/commits","review_comments_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/pulls/97/comments","review_comment_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/issues/97/comments","statuses_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/statuses/04672f2e63e38243b361548d879ccc286e8a37e9","head":{"label":"Titan-C:exitcodes","ref":"exitcodes","sha":"04672f2e63e38243b361548d879ccc286e8a37e9","user":{"login":"Titan-C","id":713451,"avatar_url":"https://avatars.githubusercontent.com/u/713451?v=3","gravatar_id":"","url":"https://api.github.com/users/Titan-C","html_url":"https://github.com/Titan-C","followers_url":"https://api.github.com/users/Titan-C/followers","following_url":"https://api.github.com/users/Titan-C/following{/other_user}","gists_url":"https://api.github.com/users/Titan-C/gists{/gist_id}","starred_url":"https://api.github.com/users/Titan-C/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Titan-C/subscriptions","organizations_url":"https://api.github.com/users/Titan-C/orgs","repos_url":"https://api.github.com/users/Titan-C/repos","events_url":"https://api.github.com/users/Titan-C/events{/privacy}","received_events_url":"https://api.github.com/users/Titan-C/received_events","type":"User","site_admin":false},"repo":{"id":26191147,"name":"sphinx-gallery","full_name":"Titan-C/sphinx-gallery","owner":{"login":"Titan-C","id":713451,"avatar_url":"https://avatars.githubusercontent.com/u/713451?v=3","gravatar_id":"","url":"https://api.github.com/users/Titan-C","html_url":"https://github.com/Titan-C","followers_url":"https://api.github.com/users/Titan-C/followers","following_url":"https://api.github.com/users/Titan-C/following{/other_user}","gists_url":"https://api.github.com/users/Titan-C/gists{/gist_id}","starred_url":"https://api.github.com/users/Titan-C/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Titan-C/subscriptions","organizations_url":"https://api.github.com/users/Titan-C/orgs","repos_url":"https://api.github.com/users/Titan-C/repos","events_url":"https://api.github.com/users/Titan-C/events{/privacy}","received_events_url":"https://api.github.com/users/Titan-C/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Titan-C/sphinx-gallery","description":"Sphinx extension for automatic generation of an example gallery","fork":true,"url":"https://api.github.com/repos/Titan-C/sphinx-gallery","forks_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/forks","keys_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/teams","hooks_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/hooks","issue_events_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/issues/events{/number}","events_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/events","assignees_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/assignees{/user}","branches_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/branches{/branch}","tags_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/tags","blobs_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/git/refs{/sha}","trees_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/statuses/{sha}","languages_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/languages","stargazers_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/stargazers","contributors_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/contributors","subscribers_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/subscribers","subscription_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/subscription","commits_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/commits{/sha}","git_commits_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/git/commits{/sha}","comments_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/comments{/number}","issue_comment_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/issues/comments{/number}","contents_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/contents/{+path}","compare_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/merges","archive_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/downloads","issues_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/issues{/number}","pulls_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/pulls{/number}","milestones_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/milestones{/number}","notifications_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/labels{/name}","releases_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/releases{/id}","deployments_url":"https://api.github.com/repos/Titan-C/sphinx-gallery/deployments","created_at":"2014-11-04T22:13:32Z","updated_at":"2016-01-14T21:43:00Z","pushed_at":"2016-07-03T18:48:34Z","git_url":"git://github.com/Titan-C/sphinx-gallery.git","ssh_url":"git@github.com:Titan-C/sphinx-gallery.git","clone_url":"https://github.com/Titan-C/sphinx-gallery.git","svn_url":"https://github.com/Titan-C/sphinx-gallery","homepage":null,"size":696,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"sphinx-gallery:master","ref":"master","sha":"5f7546a38676d3209af73a3c26230789311fa270","user":{"login":"sphinx-gallery","id":9541799,"avatar_url":"https://avatars.githubusercontent.com/u/9541799?v=3","gravatar_id":"","url":"https://api.github.com/users/sphinx-gallery","html_url":"https://github.com/sphinx-gallery","followers_url":"https://api.github.com/users/sphinx-gallery/followers","following_url":"https://api.github.com/users/sphinx-gallery/following{/other_user}","gists_url":"https://api.github.com/users/sphinx-gallery/gists{/gist_id}","starred_url":"https://api.github.com/users/sphinx-gallery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sphinx-gallery/subscriptions","organizations_url":"https://api.github.com/users/sphinx-gallery/orgs","repos_url":"https://api.github.com/users/sphinx-gallery/repos","events_url":"https://api.github.com/users/sphinx-gallery/events{/privacy}","received_events_url":"https://api.github.com/users/sphinx-gallery/received_events","type":"Organization","site_admin":false},"repo":{"id":25860190,"name":"sphinx-gallery","full_name":"sphinx-gallery/sphinx-gallery","owner":{"login":"sphinx-gallery","id":9541799,"avatar_url":"https://avatars.githubusercontent.com/u/9541799?v=3","gravatar_id":"","url":"https://api.github.com/users/sphinx-gallery","html_url":"https://github.com/sphinx-gallery","followers_url":"https://api.github.com/users/sphinx-gallery/followers","following_url":"https://api.github.com/users/sphinx-gallery/following{/other_user}","gists_url":"https://api.github.com/users/sphinx-gallery/gists{/gist_id}","starred_url":"https://api.github.com/users/sphinx-gallery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sphinx-gallery/subscriptions","organizations_url":"https://api.github.com/users/sphinx-gallery/orgs","repos_url":"https://api.github.com/users/sphinx-gallery/repos","events_url":"https://api.github.com/users/sphinx-gallery/events{/privacy}","received_events_url":"https://api.github.com/users/sphinx-gallery/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sphinx-gallery/sphinx-gallery","description":"Sphinx extension for automatic generation of an example gallery","fork":false,"url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery","forks_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/forks","keys_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/teams","hooks_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/hooks","issue_events_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/issues/events{/number}","events_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/events","assignees_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/assignees{/user}","branches_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/branches{/branch}","tags_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/tags","blobs_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/git/refs{/sha}","trees_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/statuses/{sha}","languages_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/languages","stargazers_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/stargazers","contributors_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/contributors","subscribers_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/subscribers","subscription_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/subscription","commits_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/commits{/sha}","git_commits_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/git/commits{/sha}","comments_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/comments{/number}","issue_comment_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/issues/comments{/number}","contents_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/contents/{+path}","compare_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/merges","archive_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/downloads","issues_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/issues{/number}","pulls_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/pulls{/number}","milestones_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/milestones{/number}","notifications_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/labels{/name}","releases_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/releases{/id}","deployments_url":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/deployments","created_at":"2014-10-28T08:41:46Z","updated_at":"2016-06-27T14:16:27Z","pushed_at":"2016-07-03T18:48:34Z","git_url":"git://github.com/sphinx-gallery/sphinx-gallery.git","ssh_url":"git@github.com:sphinx-gallery/sphinx-gallery.git","clone_url":"https://github.com/sphinx-gallery/sphinx-gallery.git","svn_url":"https://github.com/sphinx-gallery/sphinx-gallery","homepage":"http://sphinx-gallery.readthedocs.io","size":755,"stargazers_count":39,"watchers_count":39,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":25,"forks":20,"open_issues":25,"watchers":39,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/pulls/97"},"html":{"href":"https://github.com/sphinx-gallery/sphinx-gallery/pull/97"},"issue":{"href":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/issues/97"},"comments":{"href":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/issues/97/comments"},"review_comments":{"href":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/pulls/97/comments"},"review_comment":{"href":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/pulls/97/commits"},"statuses":{"href":"https://api.github.com/repos/sphinx-gallery/sphinx-gallery/statuses/04672f2e63e38243b361548d879ccc286e8a37e9"}}}}
{"actor":{"display_login":"Titan-C"}}