Hacker News new | ask | show | jobs
by fooofw 1162 days ago
For anybody following along with the examples, a few points/tips that might help newcomers:

1. (By default) before you can use Python source blocks, you need to have the Org Babel Python functionality loaded which is most easily done by evaluating the elisp (require 'ob-babel), but there are other ways also [1].

2. The first example, which uses the print function, will not output anything because the Python blocks by default are evaluated inside a function body and the return value is returned to Org [2]. To return the printed output instead, you need the header argument ":results output". There is an example of this syntax later in TFA.

3. If you are serious about replacing (or complementing) other Jupyter tools with Org mode, you might want to eventually look at emacs-jupyter [3], which provides a more advanced handling of outputs and also supports other (i.e. non-Python) kernels.

Also, I don't think I've ever seen anything like the debugging example and when I tried to replicate it out of curiosity, the block simply failed with a bdb.BdbQuit exception. Am I missing something? What is supposed to happen?

[1] https://orgmode.org/manual/Languages.html

[2] https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-...

[3] https://github.com/nnicandro/emacs-jupyter