Code block header argument ~replace~ seems to not to work in conjunction
with ~raw~. This leads to output being pre-pended instead of being
replaced to the results block.

Below is a working example:

#+begin_src python :session *python-test* :results output raw replace
  print('This line will be added every time this code runs')
#+end_src

#+RESULTS:
This line will be added every time this code runs

Best regards,
Sergey Koshelev.


Setup info:

Emacs  : GNU Emacs 26.2 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109))
of 2019-04-12
Package: Org mode version 9.3.7 (9.3.7-22-gbd9785-elpaplus @ /Users/skoshelev/.emacs.d/elpa/26.2/develop/org-plus-contrib-20200824/)

current state:
==============
(setq
org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer)
org-latex-listings 'minted
org-capture-prepare-finalize-hook '(org-roam-capture--install-finalize)
org-link-shell-confirm-function 'yes-or-no-p
org-babel-after-execute-hook '(spacemacs/ob-fix-inline-images)
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-roam-title-to-slug-function 'org-roam--title-to-slug
org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
org-refile-targets '((org-agenda-files :maxlevel . 3))
org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function
org-enforce-todo-dependencies t
org-src-tab-acts-natively t
org-odt-format-headline-function 'org-odt-format-headline-default-function
org-latex-pdf-process '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
                         "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")
org-imenu-depth 8
org-download-annotate-function 'org-download-annotate-default
org-agenda-files '("~/org/gcal.org" "~/org/Projects.org" "~/org/brain/Brain.org"
                    "~/org/todo list.org")
org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
org-latex-to-mathml-convert-command "latexmlmath \"%i\" --presentationmathml=%o"
org-reveal-start-hook '(org-decrypt-entry)
org-modules '(org-habit ol-w3m ol-bbdb ol-bibtex ol-docview ol-gnus ol-info ol-irc ol-mhe ol-rmail
               ol-eww)
org-blocker-hook '(org-block-todo-from-children-or-siblings-or-parent)
org-roam-buffer-prepare-hook '(org-roam-buffer--insert-title org-roam-buffer--insert-backlinks
                                org-roam-buffer--insert-ref-links)
org-archive-location "~/org/Archived projects.org::"
org-mode-hook '(org-tempo-setup flyspell-mode spacemacs/org-setup-evil-surround
                 spacemacs/load-yasnippet toc-org-enable org-superstar-mode
                 #[0 "\301\211\207" [imenu-create-index-function org-imenu-get-tree] 2]
                 #[0 "\300\301\302\303\304$\207"
                   [add-hook change-major-mode-hook org-show-all append local] 5]
                 #[0 "\300\301\302\303\304$\207"
                   [add-hook change-major-mode-hook org-babel-show-result-all append local] 5]
                 org-babel-result-hide-spec org-babel-hide-all-hashes org-download-enable
                 dotspacemacs//prettify-spacemacs-docs spacemacs//org-babel-do-load-languages
                 spacemacs//evil-org-mode org-eldoc-load spacemacs//init-company-org-mode
                 company-mode)
org-roam-mode t
org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
org-outline-path-complete-in-steps nil
org-archive-hook '(org-attach-archive-delete-maybe)
org-agenda-restore-windows-after-quit t
org-confirm-elisp-link-function 'yes-or-no-p
org-startup-indented t
org-gcal-fetch-file-alist '(("srg.koshelev@gmail.com" . "~/org/gcal.org")
                             ("lifg1dsiqjkpd3ms7sq3sctr4s@group.calendar.google.com" .
                              "~/org/work.org")
                             )
org-roam-title-change-hook '(org-roam--update-file-name-on-title-change
                              org-roam--update-links-on-title-change)
org-brain-visualize-sort-function 'org-brain-title<
org-download-file-format-function 'org-download-file-format-default
org-roam-db-gc-threshold 402653184
org-roam-capture-function 'org-capture
org-journal-mode-hook '(#[0 "\301\302\303\304$\207"
                           [org-journal-encrypt-on add-hook org-journal-encryption-hook nil t] 5]
                         (lambda nil
                          (add-hook org-journal-encrypt-on (quote org-journal-encryption-hook) nil t)
                          )
                         )
org-projectile-per-project-filepath "TODOs.org"
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-metaup-hook '(org-babel-load-in-session-maybe)
org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"]
org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
org-babel-pre-tangle-hook '(save-buffer)
org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
org-babel-load-languages '((python . t) (calc . t) (shell . t) (gnuplot . t) (ditaa . t))
org-log-done 'time
org-journal-date-format "%A, %B %d %Y"
org-brain-visualize-mode-hook '((lambda nil
                                  (define-key org-brain-visualize-mode-map (kbd "o")
                                   (quote brain-open-narrow))
                                  )
                                 )
org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME CONTENTS WIDTH)"]
org-src-lang-modes '(("arduino" . arduino) ("redis" . redis) ("php" . php) ("C" . c) ("C++" . c++)
                      ("asymptote" . asy) ("bash" . sh) ("beamer" . latex) ("calc" . fundamental)
                      ("cpp" . c++) ("ditaa" . artist) ("dot" . fundamental) ("elisp" . emacs-lisp)
                      ("ocaml" . tuareg) ("screen" . shell-script) ("shell" . sh) ("sqlite" . sql))
org-gcal-client-secret "h2gaJ80b9y0DIv4pWC5l7pi-"
org-occur-hook '(org-first-headline-recenter)
org-journal-encrypt-journal t
org-log-into-drawer t
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines
                  org-optimize-window-after-visibility-change)
org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "WAITING(w)" "|" "POSTPONED(p)" "CANCEL(c)"
                      "DONE(d)")
                     )
org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate)
org-capture-before-finalize-hook '(org-gcal--capture-post)
org-capture-mode-hook '(spacemacs//org-capture-start)
org-clock-persist-file "/Users/skoshelev/.emacs.d/.cache/org-clock-save.el"
org-gcal-client-id "525889303624-nlher67h6k5pq5n8p2r288gv7a7s6unf.apps.googleusercontent.com"
org-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-function
org-latex-prefer-user-labels t
org-journal-dir "~/org/journal/"
org-babel-tangle-lang-exts '(("python" . "py") ("emacs-lisp" . "el") ("elisp" . "el"))
org-publish-timestamp-directory "/Users/skoshelev/.emacs.d/.cache/.org-timestamps/"
org-export-async-init-file "/Users/skoshelev/.emacs.d/layers/+emacs/org/local/org-async-init.el"
org-refile-use-outline-path 'file
org-id-locations-file "/Users/skoshelev/.emacs.d/.cache/.org-id-locations"
org-confirm-shell-link-function 'yes-or-no-p
org-link-parameters '(("eww" :follow eww :store org-eww-store-link)
                       ("rmail" :follow org-rmail-open :store org-rmail-store-link)
                       ("mhe" :follow org-mhe-open :store org-mhe-store-link)
                       ("irc" :follow org-irc-visit :store org-irc-store-link :export org-irc-export)
                       ("info" :follow org-info-open :export org-info-export :store
                        org-info-store-link)
                       ("gnus" :follow org-gnus-open :store org-gnus-store-link)
                       ("docview" :follow org-docview-open :export org-docview-export :store
                        org-docview-store-link)
                       ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link)
                       ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete
                        org-bbdb-complete-link :store org-bbdb-store-link)
                       ("w3m" :store org-w3m-store-link)
                       ("brainswitch" :complete org-brain--switch-link-complete :follow
                        org-brain--switch-link-follow)
                       ("brain-friend" :complete
                        #[0 "\301!\207" [org-brain-friend-link-name org-brain-link-complete] 2]
                        :follow org-brain-goto)
                       ("brain-parent" :complete
                        #[0 "\301!\207" [org-brain-parent-link-name org-brain-link-complete] 2]
                        :follow org-brain-goto)
                       ("brain-child" :complete
                        #[0 "\301!\207" [org-brain-child-link-name org-brain-link-complete] 2]
                        :follow org-brain-goto)
                       ("brain" :complete org-brain-link-complete :follow org-brain-goto :store
                        org-brain-link-store)
                       ("attachment" :follow org-attach-open-link :export org-attach-export-link
                        :complete org-attach-complete-link)
                       ("roam" :follow org-roam-link-follow-link)
                       ("id" :follow org-id-open :face org-roam--id-link-face)
                       ("orgit-rev" :store orgit-rev-store :follow orgit-rev-open :export
                        orgit-rev-export :complete orgit-rev-complete-link)
                       ("orgit-log" :store orgit-log-store :follow orgit-log-open :export
                        orgit-log-export :complete orgit-log-complete-link)
                       ("orgit" :store orgit-status-store :follow orgit-status-open :export
                        orgit-status-export :complete orgit-status-complete-link)
                       ("file+sys") ("file+emacs") ("shell" :follow org-link--open-shell)
                       ("news" :follow
                        #[257 "\301\300\302Q!\207" ["news" browse-url ":"] 5 "\n\n(fn URL)"])
                       ("mailto" :follow
                        #[257 "\301\300\302Q!\207" ["mailto" browse-url ":"] 5 "\n\n(fn URL)"])
                       ("https" :follow
                        #[257 "\301\300\302Q!\207" ["https" browse-url ":"] 5 "\n\n(fn URL)"])
                       ("http" :follow
                        #[257 "\301\300\302Q!\207" ["http" browse-url ":"] 5 "\n\n(fn URL)"])
                       ("ftp" :follow
                        #[257 "\301\300\302Q!\207" ["ftp" browse-url ":"] 5 "\n\n(fn URL)"])
                       ("help" :follow org-link--open-help)
                       ("file" :complete org-link-complete-file :face org-roam--file-link-face)
                       ("elisp" :follow org-link--open-elisp) ("doi" :follow org-link--open-doi))
org-journal-file-type 'monthly
org-latex-format-headline-function 'org-latex-format-headline-default-function
org-present-mode-hook '(spacemacs//org-present-start)
org-capture-templates '(("t" "Next" entry (file "~/org/todo list.org") "* NEXT %?\n%U" :empty-lines
                          1)
                         ("p" "Project" entry (file "~/org/Projects.org")
                          "* %? [%]\n%U\n** NEXT Define next action" :empty-lines 0)
                         )
org-link-translation-function 'toc-org-unhrefify
org-link-elisp-confirm-function 'yes-or-no-p
org-capture-after-finalize-hook '(google-calendar/sync-cal-after-capture)
org-latex-format-inlinetask-function 'org-latex-format-inlinetask-default-function
org-tab-before-tab-emulation-hook '(org-tempo-complete-tag)
org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
org-latex-packages-alist '(("" "minted"))
org-image-actual-width nil
org-roam-directory "~/org/roam"
org-journal-file-format "%Y-%m"
org-present-mode-quit-hook '(spacemacs//org-present-end)
org-html-format-headline-function 'org-html-format-headline-default-function
org-confirm-babel-evaluate nil
org-agenda-custom-commands '(("w" "Weekly review" tags "CLOSED>=\"<-1w>\""))
org-download-link-format-function 'org-download-link-format-function-default
org-download-abbreviate-filename-function 'file-relative-name
org-default-notes-file "/Users/skoshelev/org/notes.org"
)



Sent with ProtonMail Secure Email.