Problem with input() and IPython Console in Spyder 5.1.5 on Mac

I’m giving an introductory course in Python programming for high-school students and we have encountered a problem with Anaconda/spyder on Mac.

Many of my students get a problem when trying to use the input function and get the following error message:

Traceback (most recent call last): File “/Users/user/opt/anaconda3/lib/python3.9/site-packages/qtconsole/base_frontend_mixin.py”, line 138, in _dispatch handler(msg) File “/Users/user/opt/anaconda3/lib/python3.9/site-packages/spyder/plugins/ipythonconsole/widgets/debugging.py”, line 267, in _handle_input_request return super(DebuggingWidget, self)._handle_input_request(msg) File “/Users/user/opt/anaconda3/lib/python3.9/site-packages/qtconsole/frontend_widget.py”, line 516, in _handle_input_request self._readline(msg[‘content’][‘prompt’], callback=callback, password=msg[‘content’][‘password’]) File “/Users/user/opt/anaconda3/lib/python3.9/site-packages/qtconsole/console_widget.py”, line 2413, in _readline self._show_prompt(prompt, newline=False, separator=False) TypeError: _show_prompt() got an unexpected keyword argument ‘separator’

In short, when running a script containing input(), Spyder crashes. It looks like a problem with the IPython console itself because when using an external terminal everything works fine. The only difference I can see between my version and the students’ is that I run Python 3.9.7 and they run 3.9.12. We all use Spyder 5.1.5 running on Mac.

Is there an easy solution to this?

1 Like

dear tomas.rydholm.

thank you for your posting.
This issue is discussed on github at the following URL.

We don’t know the root cause, but it seems to be a problem with readline in IPython.
As a past example, problems have also occurred with backspace (\b) and cartridge return (\r), and it seems that there is a problem with bytecode handling.

So the current solution, as mentioned in the github discussion above, is to follow the process below.

  1. Upgrade spyder to 5.2.2.
  2. Create an environment dedicated to spyder by executing the following command.

conda create -n spyder-cf -c conda-forge spyder
conda activate spyder-cf
spyder

It is very sad that the students and you will be inconvenienced, but in this case, we will inform you that it is necessary to execute it at the command prompt.

Regards, you.
ktsh.tanaka.2020

Thanks for your support. It seems to work for us now.