Hi Kyle, Thanks for the thorough review as always. An updated patch incorporating your feedback is at the end of this email. I'd like to do the honors of making my first push to the repo :) So please let me know if you're fine with me to proceed. Or, if you have more comments, they are always appreciated. Kyle Meyer writes: > Tangent: You can get better context for your diffs if you define a > custom xfuncname. Thanks for the tip! >> +with open('%s') as f: > > Hmm, I'm nervous about breakage here if org-babel-temp-file returns > something with a single quote. However, that's already a problem with > org-babel-python--exec-tmpfile used for ":results output", as well as > with a couple of other spots, so I think it'd be okay to punt on that > for now. Thanks for pointing this out, I've noted it and will try to fix it in future. > Hmm, we set the result to the exception on error, so the exception will > now show up under "#+RESULTS:". As a not-really-babel user, my guess is > that that'd be a good thing, but I do wonder how other languages handle > exceptions. I'm most familiar with R, Julia, and shell so I checked how those languages deal with errors when ":session :results value". In general, they print an empty "#+RESULTS:" element, with the exception of Julia which hangs Emacs. So, printing an empty results block would be the more consistent behavior here. This can be achieved by setting __org_babel_python_final to the empty string in the exception clause. On the other hand, I do think that printing the traceback is useful behavior. For now, I've opted to keep the traceback output, because we've already written it, and it's easy to remove later if we want. But I don't have a strong opinion here. > I've included a patch at the end that sits on top of yours and does > those two things. If it looks reasonable to you, please squash it into > your patch. Looks good, I've squashed it in, however I did add back a call to "raise" in the exception block, so that the error would appear in the REPL (which was the general behavior for shell, R, and Julia errors).