3

Description:

I'm using Vscode Studio for python coding, I've installed every extension related to python and I wanna use Jupyter. I'm experiencing no problem with importing packages or running code but when I try to grab the input from the user it throws me an error stating 'StdinNotImplementedError: raw_input was called, but this frontend does not support input requests.' which I don't find using the console.

[Image Error] https://i.stack.imgur.com/BDUC5.jpg

Error

StdinNotImplementedError                  Traceback (most recent call last)
 in 
      9 while 1:
     10     #ask for new item
---> 11     new_item=input("> ")
     12     #add new items to our list
     13     shopping_list.append(new_item)

~\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ipykernel\kernelbase.py in raw_input(self, prompt)
    846         if not self._allow_stdin:
    847             raise StdinNotImplementedError(
--> 848                 "raw_input was called, but this frontend does not support input requests."
    849             )
    850         return self._input_request(str(prompt),

StdinNotImplementedError: raw_input was called, but this frontend does not support input requests.

Steps Taken:

  1. Use the raw_input function instead of input.
  2. Install and uninstall python and jupyter extension.
  3. Checked the version of jupyter notebook --version (5.7.4) and python -m ipykernel --version (7.2.0).
  4. Restarted kernel but encounter the same error.

Observation: The issue is not replicable when the code is executed with python integrated terminal

Please let me know if there is setting which I'm missing or is this a bug.

Joe Ferndz
  • 8,417
  • 2
  • 13
  • 33
Shaz
  • 181
  • 2
  • 5
  • Please ask question in proper format. – raju_odi Dec 24 '18 at 07:53
  • Here is [a similar question](https://stackoverflow.com/questions/52279989/evaluation-failed-because-the-thread-is-not-suspended) that might help. It's for java but that shouldn't be relevant here. – Joakim Danielson Dec 24 '18 at 08:01
  • @Joakim Danielson, Thanks but this issue is only with vs code studio when using jupyter functionality and only when somebody takes input using input command. – Shaz Dec 24 '18 at 08:13

1 Answers1

2

Ctrl + Shift + D

Environment -> Python This creates launch.json file within a .vscode directory in the current directory

Paste the following json:

{
"version": "0.2.0",
"configurations": [
    {
        "name": "Python",
        "type": "python",
        "request": "launch",
        "stopOnEntry": true,
        "pythonPath": "${config.python.pythonPath}",
        "program": "${file}",
        "debugOptions": [
            "WaitOnAbnormalExit",
            "WaitOnNormalExit",
            "RedirectOutput"
        ],
        "console": "integratedTerminal"
    }
]}

Save the file and open python script in the editor Start without debugging

Dmytro Dadyka
  • 2,208
  • 5
  • 18
  • 31
loki
  • 976
  • 1
  • 10
  • 22