I'm trying to use xonsh as my python interpreter in Emacs (the one invoked by run-python). I tried to do this by setting python-shell-interpreter to "xonsh". This works, but there are two issues:

  • The prompt is printed twice (but results are only printed once)
  • When I try to do something like find-file in a python buffer while the interpreter is open, this hangs (until I press C-g) and gives me thef ollowing in *Messages*:

    error in process filter: python-shell-comint-end-of-output-p: Wrong type argument: arrayp, nil error in process filter: Wrong type argument: arrayp, nil

1 Answer 1


I suggest you use for interactive xonsh sessions shell-mode instead. (It works well for me; after all xonsh is a shell.)

Read for install requirements from the xonsh documentation: How do I use xonsh inside Emacs?

In a nutshell: Make sure you install xonsh with readline support and in your .xonshrc file define $SHELL_TYPE = 'readline' Also, in Emacs set explicit-shell-file-name to your xonsh executable.

  • In my experience can also use (setq shell-file-name "xonsh") instead of the explicit-shell-file-name. I'm guessing that would be convenient for running in the environment that emacs was started in instead of hardcoding it.
    – salotz
    Mar 5, 2020 at 0:15
  • Yes it works except if you call emacs's shell-command with spaces in arguments. emacs escapes them with a back slash which xonsh doesn't understand - you can patch shell-command to work like msdos as that just surrounds the argument by "
    – mmmmmm
    Apr 17, 2023 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.