branch: externals/org commit e8413b98eae53620b2108ac191aa0f5f239e69e7 Merge: ecde809349 a8a0d4ac0d Author: Jack Kamm <jackk...@gmail.com> Commit: Jack Kamm <jackk...@gmail.com>
Merge branch 'bugfix' --- lisp/ob-python.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lisp/ob-python.el b/lisp/ob-python.el index a2a361c799..c677b3813a 100644 --- a/lisp/ob-python.el +++ b/lisp/ob-python.el @@ -160,14 +160,14 @@ file to save the graphics to.") (defconst org-babel-python--def-format-value "\ def __org_babel_python_format_value(result, result_file, result_params): - with open(result_file, 'w') as f: + with open(result_file, 'w') as __org_babel_python_tmpfile: if 'graphics' in result_params: result.savefig(result_file) elif 'pp' in result_params: import pprint - f.write(pprint.pformat(result)) + __org_babel_python_tmpfile.write(pprint.pformat(result)) elif 'list' in result_params and isinstance(result, dict): - f.write(str(['{} :: {}'.format(k, v) for k, v in result.items()])) + __org_babel_python_tmpfile.write(str(['{} :: {}'.format(k, v) for k, v in result.items()])) else: if not set(result_params).intersection(\ ['scalar', 'verbatim', 'raw']): @@ -200,7 +200,7 @@ def __org_babel_python_format_value(result, result_file, result_params): result = result.tolist() else: result = repr(result) - f.write(str(result))" + __org_babel_python_tmpfile.write(str(result))" "Python function to format value result and save it to file.") (defun org-babel-variable-assignments:python (params) @@ -488,8 +488,8 @@ non-nil, then save graphical results to that file instead." (pcase result-type (`output (let ((body (format "\ -with open('%s') as f: - exec(compile(f.read(), f.name, 'exec'))" +with open('%s') as __org_babel_python_tmpfile: + exec(compile(__org_babel_python_tmpfile.read(), __org_babel_python_tmpfile.name, 'exec'))" (org-babel-process-file-name tmp-src-file 'noquote)))) (org-babel-python-send-string session body)))