NOTE: After restarting the python session and deleting all of the cache files about five separate times, everything started working as expected and I can't replicate the problem. I would still be interested in any explanations of the original issue, though.
I am working with a
.org file with org-babel code blocks executing code in a single python session. After executing the first few blocks, once I get to a particular block, all subsequent attempts to execute code blocks with
<C-c><C-c> result in the output of a file from my
/tmp/ directory being inserted into the buffer. I am looking for any guidance on how to debug this issue. Can I reasonably assume this behavior is coming from
babel and not from something in my python code? Are there more details that would help in solving this problem?
The particular block where this problem begins to occur is:
#+BEGIN_SRC python :session tv :results value with open(impath / "imagenet_classes.txt") as f: labels = [line.strip() for line in f.readlines()] #+END_SRC
This returns a cached file with the results of an earlier block:
#+BEGIN_SRC python :session tv :results value out = resnet(batch_t) out #+END_SRC
out is a
pytorch Tensor with 1000 values. After running the block noted above, all subsequent block return the contents of a cached file in
/tmp/ with the
out. This is true even of something very simple that does not reference any existing variables, such as:
#+BEGIN_SRC python :session tv :results value 1+1 #+END_SRC #+RESULTS: :results: tensor([[ 8.0883e+00, 7.6359e+00, 7.5604e+00, 7.4837e+00, 7.2821e+00, 7.0158e+00, 6.9879e+00, 5.7778e+00, 5.6043e+00, 5.5918e+00, 5.5413e+00, 5.5319e+00, 5.4627e+00, 5.3930e+00, 5.2824e+00, 5.1776e+00, 5.1715e+00, 5.0799e+00, 5.0772e+00, 5.0520e+00, 5.0075e+00, 4.9391e+00, 4.9213e+00, 4.8950e+00, 4.8217e+00, ...(etc)
After executing this or any other block, the python session shows the following:
>>> open('/tmp/python-DDq6Hi', 'w').write(str(_)) >>> 'org_babel_python_eoe' 14832 >>> >>> >>> 'org_babel_python_eoe' >>>
'/tmp/python-DDq6Hi' is the aforementioned
tmp file with the
My default header args are as follows:
(setq org-babel-default-header-args '((:eval . "never-export") (:exports . "both") (:cache . "no") (:results . "replace drawer")))
:cache . "no" after the emergence of this problem, but it didn't have any effect. I also tried deleting all of the cache files and restarting the python session, but ran into the same problem at the same place. I've also tried several variations of the
:results header (
values, leaving it blank, etc.).
Org mode version 9.3.7 (9.3.7-24-g7b657c-elpaplus @ /home/djliden91/.emacs.d/elpa/org-plus-contrib-20200831/)
GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.22, cairo version 1.17.3) of 2020-08-28
'3.8.5 (default, Jul 27 2020, 08:42:51) \n[GCC 10.1.0]'