Org mode python code block with session does not return a failed result
1. Symptom
The following fails in [BROKEN LINK: 6460f771-fc41-4b14-b7b0-a06416e628eb] but never tells you that it failed!
Basically this is caused by having :session
argument in the source block somehow.
I spent quite some time on Googling this but didn't find anything useful.
prin("fail me!")
2. Solution
I found this post on Emacs China that hinted there's a corresponding buffer for the session.
I didn't know this! There's a temp buffer created by using the session name defined in the code block :facepalm:. The temp buffer handles the running python session.
Just search for the buffer and you'll see the error. For example, if your session name is my, then the buffer name is my.
class Test: def m1(self): print("m1") def m2(self): pass Test().m1()
m1
Now I know where to look for the error but it'd still be great if the error can be printed into the results block. But that's the investigation for another day I guess
3. Sources
The hint post: https://emacs-china.org/t/python-code-block/395
This might be useful for future investigation: https://emacs.stackexchange.com/questions/59875/org-src-block-does-not-return-any-output