I'm using the following snippet for saving the plot in python snippets
#+NAME: save-file
#+BEGIN_SRC python :results silent :var filename="filename" plt="plt" :exports none
return f"\nfname = 'assets/' + filename + '.png'\nplt.savefig(fname)\nfname"
#+END_SRC
Using it like so
#+BEGIN_SRC python :var fig=1 filename="some-filename" :noweb strip-export :results file :session t :exports both :cache yes
import matplotlib.pyplot as plt
plt.plot(1, 1)
<<save-file("filename", "plt")>>
#+END_SRC
The issue is that `save-file` adds some extra newlines in export which I would rather omit. What am I doing wrong?
Best Regards,
Karol Wójcik