Closed rileylev closed 5 years ago
We're not sanitizing strings before passing to python in shell:
In the function spacemacs/python-execute-file
in .emacs.d/+layers/python/funcs.el in the development branch, the compile-command
is defined by
(format "%s %s"
(spacemacs/pyenv-executable-find python-shell-interpreter)
(file-name-nondirectory buffer-file-name))
If buffer-file-name
has spaces in it ("two words.py"), the format
command returns "/usr/bin/python two words.py", which will of course run python on two.
I believe calling shell-quote-argument
on the filename before passing to the format command fixes the problem:
(format "python %s" (shell-quote-argument (convert-standard-filename "two words.py")))
returns "python two\\ words.py"
Just noticed that this has been fixed on develop @bmag
Description :octocat:
spacemacs/python-execute-file
does not properly handle filenames with spaces.Reproduction guide :beetle:
M-x find-file "two words.py"
<SPC> f s
)M-x spacemac/python-execute-file
Observed behaviour: :eyes: :broken_heart: The
*compilation*
buffer saysExpected behaviour: :heart: :smile: The program should execute and
*ipython*
should display the results of executionSystem Info :computer:
Backtrace :paw_prints: